当前位置: 首页>>代码示例>>PHP>>正文


PHP kernel::url_app_map方法代码示例

本文整理汇总了PHP中kernel::url_app_map方法的典型用法代码示例。如果您正苦于以下问题:PHP kernel::url_app_map方法的具体用法?PHP kernel::url_app_map怎么用?PHP kernel::url_app_map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kernel的用法示例。


在下文中一共展示了kernel::url_app_map方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: boot

 static function boot()
 {
     self::$url_app_map = (array) (require ROOT_DIR . '/config/mapper.php');
     self::$url_app_map['/setup'] = 'setup';
     if (get_magic_quotes_gpc()) {
         self::strip_magic_quotes($_GET);
         self::strip_magic_quotes($_POST);
     }
     $pathinfo = self::request()->get_path_info();
     $jump = false;
     if (isset($pathinfo[1])) {
         if ($p = strpos($pathinfo, '/', 2)) {
             $part = substr($pathinfo, 0, $p);
         } else {
             $part = $pathinfo;
             $jump = true;
         }
     } else {
         $part = '/';
     }
     if ($part == '/api') {
         cachemgr::init();
         return kernel::single('base_rpc_service')->process($pathinfo);
     } elseif ($part == '/app-doc') {
         cachemgr::init();
         return kernel::single('base_misc_doc')->display($pathinfo);
     }
     if (isset(self::$url_app_map[$part])) {
         if ($jump) {
             $request_uri = self::request()->get_request_uri();
             $urlinfo = parse_url($request_uri);
             $query = $urlinfo['query'] ? '?' . $urlinfo['query'] : '';
             header('Location: ' . $urlinfo['path'] . '/' . $query);
             exit;
         } else {
             $app = self::$url_app_map[$part];
             $prefix_len = strlen($part) + 1;
         }
     } else {
         $app = self::$url_app_map['/'];
         $prefix_len = 1;
     }
     if (!$app) {
         readfile(ROOT_DIR . '/app/base/readme.html');
         exit;
     }
     if (!self::is_online()) {
         if (file_exists(APP_DIR . '/setup/app.xml')) {
             if ($app != 'setup') {
                 header('Location: ' . app::get('setup')->base_url());
                 exit;
             }
         } else {
             echo '<h1>System is Offline, install please.</h1>';
             exit;
         }
     } else {
         require ROOT_DIR . '/config/config.php';
     }
     date_default_timezone_set(defined('DEFAULT_TIMEZONE') ? 'Etc/GMT' . (DEFAULT_TIMEZONE >= 0 ? DEFAULT_TIMEZONE * -1 : '+' . DEFAULT_TIMEZONE * -1) : 'UTC');
     @(include APP_DIR . '/base/defined.php');
     if (isset($pathinfo[$prefix_len])) {
         $path = substr($pathinfo, $prefix_len);
     } else {
         $path = '';
     }
     //init cachemgr
     if ($app == 'setup') {
         cachemgr::init(false);
     } else {
         cachemgr::init();
     }
     //get app router
     self::$__router = app::get($app)->router();
     self::$__router->dispatch($path);
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:76,代码来源:kernel.php

示例2: boot

 static function boot()
 {
     set_error_handler(array('kernel', 'exception_error_handler'));
     try {
         if (!self::register_autoload()) {
             require dirname(__FILE__) . '/autoload.php';
         }
         require ROOT_DIR . '/config/mapper.php';
         if (self::is_online()) {
             require ROOT_DIR . '/config/config.php';
         }
         @(include APP_DIR . '/base/defined.php');
         date_default_timezone_set(defined('DEFAULT_TIMEZONE') ? 'Etc/GMT' . (DEFAULT_TIMEZONE >= 0 ? DEFAULT_TIMEZONE * -1 : '+' . DEFAULT_TIMEZONE * -1) : 'UTC');
         self::$url_app_map = $urlmap;
         foreach (self::$url_app_map as $flag => $value) {
             self::$app_url_map[$value['app']] = $flag;
         }
         if (get_magic_quotes_gpc()) {
             self::strip_magic_quotes($_GET);
             self::strip_magic_quotes($_POST);
         }
         $pathinfo = self::request()->get_path_info();
         $jump = false;
         if (isset($pathinfo[1])) {
             if ($p = strpos($pathinfo, '/', 2)) {
                 $part = substr($pathinfo, 0, $p);
             } else {
                 $part = $pathinfo;
                 $jump = true;
             }
         } else {
             $part = '/';
         }
         if ($part == '/api') {
             return kernel::single('base_rpc_service')->process($pathinfo);
         } elseif ($part == '/openapi') {
             return kernel::single('base_rpc_service')->process($pathinfo);
         } elseif ($part == '/app-doc') {
             //cachemgr::init();
             return kernel::single('base_misc_doc')->display($pathinfo);
         }
         if (isset(self::$url_app_map[$part])) {
             if ($jump) {
                 $request_uri = self::request()->get_request_uri();
                 $urlinfo = parse_url($request_uri);
                 $query = $urlinfo['query'] ? '?' . $urlinfo['query'] : '';
                 header('Location: ' . $urlinfo['path'] . '/' . $query);
                 exit;
             } else {
                 $app = self::$url_app_map[$part]['app'];
                 $prefix_len = strlen($part) + 1;
                 kernel::set_lang(self::$url_app_map[$part]['lang']);
             }
         } else {
             $app = self::$url_app_map['/']['app'];
             $prefix_len = 1;
             kernel::set_lang(self::$url_app_map['/']['lang']);
         }
         if (!$app) {
             readfile(ROOT_DIR . '/app/base/readme.html');
             exit;
         }
         if (!self::is_online()) {
             if (file_exists(APP_DIR . '/setup/app.xml')) {
                 if ($app != 'setup') {
                     //todo:进入安装check
                     setcookie('LOCAL_SETUP_URL', app::get('setup')->base_url(1), 0, '/');
                     header('Location: ' . kernel::base_url() . '/app/setup/check.php');
                     exit;
                 }
             } else {
                 echo '<h1>System is Offline, install please.</h1>';
                 exit;
             }
         }
         // 检查是否手机端
         if (base_mobiledetect::is_mobile()) {
             base_mobiledetect::select_terminator($part, $_GET['ignore_ua_check'], self::$url_app_map);
         }
         if (isset($pathinfo[$prefix_len])) {
             $path = substr($pathinfo, $prefix_len);
         } else {
             $path = '';
         }
         //init cachemgr
         if ($app == 'setup') {
             cachemgr::init(false);
         } else {
             cachemgr::init();
             cacheobject::init();
         }
         //get app router
         self::$__router = app::get($app)->router();
         self::$__router->dispatch($path);
     } catch (Exception $e) {
         base_errorpage::exception_handler($e);
     }
 }
开发者ID:sss201413,项目名称:ecstore,代码行数:98,代码来源:kernel.php


注:本文中的kernel::url_app_map方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。