Beispiel #1
0
 /**
  * 框架主入口 执行应用程序
  */
 public static function application($path = null)
 {
     self::$frameworkPath = dirname(__FILE__) . DIRECTORY_SEPARATOR;
     self::$appPath = $path == null ? './' : $path . DIRECTORY_SEPARATOR;
     //加载配置参数
     self::$config = self::config('app');
     //设置默认时区
     if (isset(self::$config['timezone'])) {
         date_default_timezone_set(self::$config['timezone']);
     }
     //获取uri
     $uri = self::URI();
     $ttt = $uri;
     if ($uri === false) {
         self::error('400', 'URI not allowed!');
     }
     //解析uri
     if ($uri) {
         $uri = self::parseURI($uri);
     }
     //定义静态资源路径
     $assets = self::$assetsPath . DIRECTORY_SEPARATOR . self::$config['struct']['assets'];
     define('ASSETS', self::$config['assets'] ? self::$config['assets'] : $assets);
     define('FILE', self::$config['file'] ? self::$config['file'] : $assets);
     define('APP_ROOT', self::$appPath ? self::$appPath : '');
     //定义试图目录
     define('VIEWROOT', self::$appPath . self::$config['struct']['view'] . DIRECTORY_SEPARATOR);
     //控制器转发
     $result = self::hub($uri, self::$config['struct']['controller'], self::$config['controller'], self::$config['action']);
     if (!$result) {
         self::error('404', 'Page not Found!');
     }
 }