PHPWarning: date (): Warning. Youare * required * tousethedate. timezonesettingorthedate_default_timezone_set () function sometimes prompts this warning 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 D: \ PHPWEB ews \ file. php on line 17.
This is because the time taken by PHP is Greenwich mean time, so there will be a difference between the GMT standard time and the Beijing time by about eight hours. we can solve this problem as follows:
1. use date_default_timezone_set () in the page header to set my default time zone to Beijing time, that is You can.
2. in php. set date in ini. the value of timezone is PRC, and the value after setting is date. timezone = PRC or date. timezone = Asia/Shanghai, and cancel the comments of this line of code, that is, remove the semicolon.
Restart apache!