PHPdate () function warning: Itisnotsafetorelyonthesystem solution, saferely. PHPdate () function warning: the Itisnotsafetorelyonthesystem solution, saferely has been notified by emails recently, and does not care about it at first. later, I read the prompt. Warning using the PHP date () function: It is not safe to rely on the system solution, saferely
There have been always system Email prompts recently, and I didn't care about it at first. later I read it as I keep reminding me. The following message is displayed:
The code is as follows:
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 gett
Ing this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing 'for 'cst/8.0/no DST 'Instead in/data0/htdocs/rows on line 542
In general, the timezone is not set. in China, the Green + 8 hours are used, so you need to set it.
First
Add the following statement to the page header:
The code is as follows:
Date_default_timezone_set ("PRC ");
This method has the disadvantage that all pages must be added.
Second
In php. ini, find the date. timezone line and change the value to PRC, for example, date. timezone = PRC. If you do not have this line, simply add it. Restart the WEB server and PHP.
PHP error prompt after phpinfo () Check
Find date. timezone in the php. ini file.
Set date. timezone = Asia/Chongqing.
When I use the date (Y-m-d H: I: s) function, the error message is as follows:
This is only a Warning. although it can be ignored, the execution result may be incorrect.
The date (Y-m-d H: I: s) parameter you wrote is incorrect. the correct syntax is:
Date ('Y-m-d H: I: S', time (); // time () can be omitted, but it is best to write it in a regular way.
In addition, if you set a time area (such as Shanghai, China), it will be more accurate.
For example, write at the beginning of the file as follows:
Date_default_timezone_set ('Asia/Shanghai'); // Set the time range to "Asia/Shanghai", that is, China.
Echo date ('Y-m-d H: I: S', time ());
?>
Hope to help you!
Http://www.bkjia.com/PHPjc/866664.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/866664.htmlTechArticlePHP date () function warning: It is not safe to rely on the system solution, saferely has recently been a system Email prompt, didn't care at first, then keep prompting to look at It. Prompt...