Php obtains the system's correct current time. incorrect php time zone. problem: date current time, time difference, local, local date_default_timezone_set1. The easiest way is not to use php5.1 or later version 2. if necessary, php cannot be modified. ini, you need to add date_default_timezone_set (XXX) to the statement about time initialization; 3, php gets the current time of the system correctly.
Incorrect php time zone time problem date current time, time difference, local, local date_default_timezone_set
1. the simplest method is not to use php5.1 or a later version.
2. if it must be used and php. ini cannot be modified, add date_default_timezone_set (XXX) to the time initialization statement );
3. only php. ini can be modified. Open php. ini and find date. timezone. remove the semicolon and add XXX. restart the http service (such as apache2 or iis ).
For XXX, the available values in mainland China are: Asia/Chongqing, Asia/Shanghai, Asia/Urumqi (Chongqing, Shanghai, and Urumqi in sequence)
Available in Hong Kong and Taiwan regions: Asia/Macao, Asia/Hong_Kong, Asia/Taipei (in the order of Macao, Hong Kong, and Taipei)
Singapore: Asia/Singapore
Other available values: Etc/GMT-8, Singapore, Hongkong, PRC (People's Republic of China)
Solution:
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!