Method 1:
Find the ";date.timezone=" line in php.ini, remove the ";" and change it to "date.timezone = PRC" (PRC: People's Republic of China), restart Apache, problem solved.
Method 2:
In versions of php5 and above, to output the local time (limited to China), you can write the code like this:
PHP code
Copy the code The code is as follows:
date_default_timezone_set('Asia/Shanghai');
echo date('Y-m-d H:i:s'); The code is as follows:
The above introduces the solution to the 8-hour time difference in p5 PHP5, including p5 content. I hope it will be helpful to friends who are interested in PHP tutorials.