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