本文整理汇总了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};
}