本文整理匯總了PHP中helper::setModelFile方法的典型用法代碼示例。如果您正苦於以下問題:PHP helper::setModelFile方法的具體用法?PHP helper::setModelFile怎麽用?PHP helper::setModelFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類helper
的用法示例。
在下文中一共展示了helper::setModelFile方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadModel
/**
* Load the model file of one module.
*
* @param string $methodName The method name, if empty, use current module's name.
* @access public
* @return object|bool If no model file, return false. Else return the model object.
*/
protected function loadModel($moduleName)
{
$modelFile = \helper::setModelFile($moduleName);
/* If no model file, try load config. */
if (!\helper::import($modelFile)) {
$this->app->loadConfig($moduleName, false);
$this->app->loadLang($moduleName);
$this->dao = new dao();
return false;
}
$modelClass = class_exists('ext' . $moduleName . 'model') ? 'ext' . $moduleName . 'model' : $moduleName . 'model';
$modelClass = '\\' . $modelClass;
if (!class_exists($modelClass)) {
$this->app->triggerError(" The model {$modelClass} not found", __FILE__, __LINE__, $exit = true);
}
$this->{$moduleName} = new $modelClass();
$this->dao = $this->{$moduleName}->dao;
return $this->{$moduleName};
}
示例2: loadModel
/**
* Load the model of one module. After loaded, can use $this->modulename to visit the model object.
*
* @param string $moduleName
* @access public
* @return object|bool the model object or false if model file not exists.
*/
public function loadModel($moduleName)
{
if (empty($moduleName)) {
return false;
}
$modelFile = helper::setModelFile($moduleName);
if (!helper::import($modelFile)) {
return false;
}
$modelClass = class_exists('ext' . $moduleName . 'model') ? 'ext' . $moduleName . 'model' : $moduleName . 'model';
if (!class_exists($modelClass)) {
$this->app->triggerError(" The model {$modelClass} not found", __FILE__, __LINE__, $exit = true);
}
$this->{$moduleName} = new $modelClass();
return $this->{$moduleName};
}
示例3: loadCommon
/**
* Load the common module
*
* The common module is a special module, which can be used to do some common things. For examle:
* start session, check priviledge and so on.
* This method should called manually in the router file(www/index.php) after the $lang, $config, $dbh loadde.
*
* @access public
* @return object|bool the common control object or false if not exits.
*/
public function loadCommon()
{
$this->setModuleName('common');
$commonModelFile = helper::setModelFile('common');
if (!file_exists($commonModelFile)) {
$commonModelFile = helper::setModelFile('common', 'sys');
}
helper::import($commonModelFile);
if (class_exists('extcommonModel')) {
return new extcommonModel();
} elseif (class_exists('commonModel')) {
return new commonModel();
} else {
return false;
}
}
示例4: loadModel
/**
* Load the model file of one module.
*
* @param string $methodName The method name, if empty, use current module's name.
* @access public
* @return object|bool If no model file, return false. Else return the model object.
*/
public function loadModel($moduleName = '')
{
if (empty($moduleName)) {
$moduleName = $this->moduleName;
}
$modelFile = helper::setModelFile($moduleName);
/* If no model file, try load config. */
if (!helper::import($modelFile)) {
$this->app->loadConfig($moduleName, false);
$this->app->loadLang($moduleName);
$this->dao = new dao();
return false;
}
$modelClass = class_exists('ext' . $moduleName . 'model') ? 'ext' . $moduleName . 'model' : $moduleName . 'model';
if (!class_exists($modelClass)) {
$this->app->error(" The model {$modelClass} not found", __FILE__, __LINE__, $exit = true);
}
$this->{$moduleName} = new $modelClass();
$this->dao = $this->{$moduleName}->dao;
return $this->{$moduleName};
}