There are two ways to solve the 8 hours related to time zone. One is to write date.timezone = PRC in php.ini, and the other is to write date_default_timezone_set('Asia/Chongqing'); in the php code. .
After php5, you have to set the time zone yourself, either by modifying the settings of php.ini or modifying it in the code.
Set time zone in PHP.INI
代码如下 | 复制代码 |
date.timezone = PRC |
Set time zone in code
代码如下 | 复制代码 |
date_default_timezone_set('PRC');//其中PRC为“中华人民共和国” |
The above can meet our needs.
When initializing the system, add
The code is as follows
|
Copy code
|
||||
ini_set('date.timezone','Asia /Shanghai');
or date_default_timezone_set("PRC");
|
The code is as follows | Copy code
|