Sometimes the following warning occurs when writing a php program:
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 ......
This is because PHP gets the Greenwich Mean Time by default, so this time will be 8 hours different from the standard Beijing time. We can solve this problem using the following method:
1. Use date_default_timezone_set ('prc') in the page header to set the time zone to Beijing time.
For details about the time zone list, refer to the solution for 8 hours of date difference in php.
2. In the server configuration file php. set date in ini. the value of timezone is PRC, and the value after setting is date. timezone = PRC, remove the semicolon above, that is, cancel the comments of this line of code.
Tip: date_timezone_set-alias DateTime: setTimezone ()
Articles you may be interested in
- Php prompts Maximum execution time of 30 seconds exceeded... solution to the error
- PhpMyAdmin Cannot start session without errors error Solution
- Php prompts Call to undefined function curl_init () Error Solution
- Select into from prompt Undeclared variable... solution to the error
- Solution to the DedeTag Engine Create File False error in dedeCMS
- Solution to the error "event is not defined" prompt in Firefox
- Fatal error Class 'soapclient' not found in... troubleshooting method
- The progress bar of XDebug stops at 57%, prompting you to solve the waiting for XDebug session error.