Home > Article > Backend Development > PHP date() and time() obtain time that is inconsistent with local time_PHP Tutorial
This article introduces the solution to the inconsistency between the time obtained by PHP date() and time() and the local time. If necessary, you can refer to the solution
Add it in the program
Use
in the header of the page The code is as follows
|
Copy code
|
||||||
date_default_timezone_set('PRC'); echo date('Y-m-d H:i:s');First solution:
|
|||||||
date_default_timezone_set('PRC'); //Set the local time zone
|