本文整理匯總了PHP中kernel::set_lang方法的典型用法代碼示例。如果您正苦於以下問題:PHP kernel::set_lang方法的具體用法?PHP kernel::set_lang怎麽用?PHP kernel::set_lang使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kernel
的用法示例。
在下文中一共展示了kernel::set_lang方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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);
}
}