当前位置:Gxlcms > PHP教程 > PHP默许时区设置

PHP默许时区设置

时间:2021-07-01 10:21:17 帮助过:17人阅读

PHP默认时区设置

function.strtotime]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable 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

?

由于PHP 所取的时间是格林威治标准时间,与当地的时间会有出入.格林威治标准时间和北京时间大概差8个小时左右,解决方法:

1.在应用文件的头部添加date_default_timezone_set()设置默认时区为北京时间,即:

date_default_timezone_set("PRC");
?

2.还有一个方法就是更改php .ini文件的date.timezone,设置为:date.timezone=PRC。

人气教程排行