Sometimes this warning will appear when writing PHP programs:
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for '8.0/no DST' instead in D:PHPWEB ewsfile.php on line 17 .
This is because the time taken by PHP is Greenwich Mean Time, so it will be different from your local time. The difference between Greenwich Mean Time and Beijing time is about 8 hours. We can solve it according to the following method:
1. Use date_default_timezone_set() on the header of the page to set my default time zone to Beijing time, that is, That's it.
2. Set the value of date.timezone in php.ini to PRC. After setting, it will be: date.timezone=PRC or date.timezone = Asia/Shanghai. At the same time, uncomment this line of code, that is, remove the preceding one. The semicolon is fine.
Then restart apache!