diff --git a/convention.php b/convention.php index 74ff049c..24b2f173 100644 --- a/convention.php +++ b/convention.php @@ -21,6 +21,8 @@ return [ 'default_jsonp_handler' => 'jsonpReturn', // 默认JSONP处理方法 'var_jsonp_handler' => 'callback', + // 默认时区 + 'default_timezone' => 'PRC', // +---------------------------------------------------------------------- // | 模块设置 diff --git a/library/think/app.php b/library/think/app.php index a303c78c..1459f9f4 100644 --- a/library/think/app.php +++ b/library/think/app.php @@ -47,6 +47,8 @@ class App if (SLOG_ON) { Slog::config($config['slog']); } + // 设置系统时区 + date_default_timezone_set($config['default_timezone']); // 默认语言 $lang = strtolower($config['default_lang']); @@ -273,10 +275,10 @@ class App $depr = $config['pathinfo_depr']; // 还原劫持后真实pathinfo $path_info = - (defined('BIND_MODULE') ? BIND_MODULE . $depr : '') . - (defined('BIND_CONTROLLER') ? BIND_CONTROLLER . $depr : '') . - (defined('BIND_ACTION') ? BIND_ACTION . $depr : '') . - __INFO__; + (defined('BIND_MODULE') ? BIND_MODULE . $depr : '') . + (defined('BIND_CONTROLLER') ? BIND_CONTROLLER . $depr : '') . + (defined('BIND_ACTION') ? BIND_ACTION . $depr : '') . + __INFO__; // 路由检测 if (!empty($config['url_route_on'])) {