[fix] default_timezone

This commit is contained in:
lkeme 2020-04-06 14:32:15 +08:00
parent 46930d28bd
commit efc8ef84e9
2 changed files with 18 additions and 17 deletions

View File

@ -23,7 +23,7 @@ class App
*/ */
public function __construct() public function __construct()
{ {
(new Env())->set_configure()->inspect_extension(); (new Env())->inspect_configure()->inspect_extension();
} }
/** /**

View File

@ -20,15 +20,12 @@ class Env
*/ */
public function __construct() public function __construct()
{ {
Log::info("欢迎使用 {$this->app_name} 当前版本 {$this->app_version}"); set_time_limit(0);
Log::info("程序使用相关请移步 https://github.com/lkeme/BiliHelper-personal 文档部分查看。"); header("Content-Type:text/html; charset=utf-8");
// ini_set('date.timezone', 'Asia/Shanghai');
if (PHP_SAPI != 'cli') { date_default_timezone_set('Asia/Shanghai');
die("Please run this script from command line ."); ini_set('display_errors', 'on');
} error_reporting(E_ALL);
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
die("Please upgrade PHP version >= 7.0.0 .");
}
} }
/** /**
@ -48,15 +45,19 @@ class Env
} }
/** /**
* @use 环境配置 * @use 检查环境
*/ */
public function set_configure() public function inspect_configure()
{ {
set_time_limit(0); Log::info("欢迎使用 {$this->app_name} 当前版本 {$this->app_version}");
error_reporting(E_ALL); Log::info("程序使用相关请移步 https://github.com/lkeme/BiliHelper-personal 文档部分查看。");
ini_set('display_errors', 'on');
header("Content-Type:text/html; charset=utf-8"); if (PHP_SAPI != 'cli') {
date_default_timezone_set('Asia/Shanghai'); die("Please run this script from command line .");
}
if (version_compare(PHP_VERSION, '7.0.0', '<')) {
die("Please upgrade PHP version >= 7.0.0 .");
}
return $this; return $this;
} }
} }