Recently, while learning PHP, I found that the formatted timestamp in PHP is 8 hours later than Beijing time. After searching online, I found that the time zone is wrong. The solution is:
1. Permanently modify
Change the php.ini file data.timezone = PRC This is China time. It will take effect after restarting the Apache service.
2. Temporary modification
Before using formatted input time, add ini_set('date.timezone','Asia/Shanghai');
or data_default_timezone_set('PRC');//date_default_timezone_set() function setting Default time zone for all date/time functions in scripts.
The above introduces PHP's time zone issues, including aspects of it. I hope it will be helpful to friends who are interested in PHP tutorials.