コード例 #1
0
 /**
  * 运行应用实例
  * @access public
  * @return void
  */
 public function run()
 {
     //引入编译、缓存过的引入文件
     $compiledIncFile = $this->getCompiledIncFileName();
     if (App::config('compile_include_files') && is_file($compiledIncFile)) {
         self::$includeFiles = (require $compiledIncFile);
     }
     //检测控制器文件是否存在
     if (!is_file(APP_PATH . '/controller/' . self::$controller . 'Controller.class.php')) {
         die("<h1>Invalid Request</h1>\nController <strong>" . self::$controller . "</strong> not found.");
     }
     //导入必需文件
     irequire(PHPFW_PATH . '/common/common.php');
     is_file(APP_PATH . '/common/common.php') && irequire(APP_PATH . '/common/common.php');
     irequire(PHPFW_PATH . '/core/Controller.class.php');
     irequire(APP_PATH . '/controller/' . self::$controller . 'Controller.class.php');
     //实例化控制器并运行
     $controllerName = self::$controller . 'Controller';
     $controller = new $controllerName();
     $controller->run(self::$action);
     //编译、缓存 引入文件
     if (App::config('compile_include_files') && !is_file($compiledIncFile)) {
         $this->compileIncFiles();
     }
 }
コード例 #2
0
ファイル: PHPFW.php プロジェクト: BGCX067/eyesphp-svn-to-git
function __autoload($className)
{
    if (isset(App::$globals['classFiles'][$className])) {
        irequire(App::$globals['classFiles'][$className]);
    } elseif (is_file($file = APP_PATH . '/model/' . $className . '.class.php')) {
        irequire($file);
    } elseif (is_file($file = APP_PATH . '/controller/' . $className . '.class.php')) {
        irequire($file);
    }
}
コード例 #3
0
 /**
  * 加载模型对象
  *
  * @param string $modelName
  * @param boolean $isFullModelName
  * @return object
  */
 public function model($modelName, $isFullModelName = false)
 {
     $isFullModelName or $modelName .= 'Model';
     if (isset($this->models[$modelName])) {
         return $this->models[$modelName];
     } else {
         $modelFile = APP_PATH . '/model/' . $modelName . '.class.php';
         if (!is_file($modelFile)) {
             die("<h1>Invalid Request</h1>\nModel <strong>{$modelName}</strong> not found!");
         }
         irequire($modelFile);
         $m = new $modelName();
         $this->models[$modelName] = $m;
         return $m;
     }
 }