PHP users may have encountered this situation. Date ("Y-m-d h: I: s") Total server time differences
Hours. I checked it online to find out. Originally, from php5.1.0, the date. timezone option was added to PhP. ini.
Is disabled by default, that is, the display time (no matter what php Command is used) is the Greenwich Mean
Accurate Time, so this happens,
The solution is as follows:
1. Use date_default_timezone_set () in the page header to set my default time zone to Beijing Time
Date_default_timezone_set ('prc ');
Echo date ('Y-m-d h: I: s ');
The time is the same as the current server time !!
2. Modify PHP. ini.
Open php5.ini to search for date. timezone. Remove the semicolon = followed by XXX and restart the HTTP service.
(Such as apache2 or IIS.
For XXX, the available values in mainland China are: Asia/Chongqing, Asia/Shanghai,
Asia/Urumqi (in the order of Chongqing, Shanghai, Urumqi) Hong Kong and Taiwan regions available: Asia/Macao,
Asia/hong_kong, Asia/Taipei (in the order of Macao, Hong Kong, and Taipei) and Singapore:
Asia/Singapore foreigners seem to have missed other available values in Beijing: ETC/GMT-8, Singapore,
What Is Hongkong, PRC, and PRC? PRC is from the People's Republic of China.
The area below GMT + 8 may be omitted.