PHP warning date (): Itisnotsafetorelyonthesystem. When PHP versions later than PHP5.3 are used, a Warning: date (): itisnotsafetorelyonthesystemstimezoneset.pdf will be reported if it is time-related. in general, the timezone is not set. When PHP versions later than PHP5.3 are used, a Warning: date () will be reported if the time is involved (): it is not safe to rely on the system \'s timezone settings.
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"); or ini_set ('date. timezone ', 'asiashanghai '); |
This method has the disadvantage that all pages must be added.
Second
Find the date. timezone line in php. ini and change the value to PRC, as shown in figure
The code is as follows: |
|
Date. timezone = PRC. |
If you do not have this line, simply add it. Restart the WEB server and PHP.
Friendly reminder: In fact, when using functions such as date () in PHP 5.1.0, if the timezone settings are incorrect, E_NOTICE or E_WARNING information will be generated each time a time function is called. In php5.1.0, date. the timezone option is disabled by default. no matter what php command is used, the Greenwich Mean Time is used. However, it seems that this error will be forcibly thrown out in PHP5.3 if it is not set, to solve this problem, just localize it.
Specified date (): It is not safe to rely on the system \'s timezone settings. It generally means that the timezone is not set ,...