當前位置: 首頁>>代碼示例>>PHP>>正文


PHP helper::setModelFile方法代碼示例

本文整理匯總了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};
 }
開發者ID:wsyandy,項目名稱:zentao-rest-api,代碼行數:26,代碼來源:Resource.php

示例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};
 }
開發者ID:dyp8848,項目名稱:chanzhieps,代碼行數:23,代碼來源:model.class.php

示例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;
     }
 }
開發者ID:leowh,項目名稱:colla,代碼行數:26,代碼來源:router.class.php

示例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};
 }
開發者ID:laiello,項目名稱:zentaoms,代碼行數:28,代碼來源:control.class.php


注:本文中的helper::setModelFile方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。