Home >Backend Development >PHP Tutorial >PHP默许时区设置

PHP默许时区设置

WBOY
WBOYOriginal
2016-06-13 10:49:40905browse

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。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php同步议案Next article:PHP缓存稽查