Since PHP5.0 start, while getting the system time with PHP, less time than the current time is 8 hours. The reason is that when PHP.ini not set timezone, PHP is UTC time used, so less time in China for 8 hours.
Solution:
1. Modify settings in PHP.ini file.
[A Date]
; The Defines The default TimeZone The DATE Functions Used by
the date.timezone = Asia / of Shanghai
here really. . . You can set Shanghai, Chongqin, Hong_Kong, TaiBei ... and so on, but I could not find Beijing, I do not know why.
2. Set the program when running PHP.
<? PHP
IF (! the date_default_timezone_get () = "1Asia / of Shanghai") date_default_timezone_set ( "Asia / of Shanghai");
?>
Note: The time set with the "date_default_timezone_get" obtained in a 1, it is not clear that the matter is heteroaryl it.
3. pay more when using their own time is 8 * 3600 seconds drip line.
<PHP?
echo DATE ( "Ymd H: I: S", Time () + 3600 *. 8);
?>
Reproduced in: https: //www.cnblogs.com/diony/p/4062044.html