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

PHP默许时区设置

WBOY
Release: 2016-06-13 13:11:25
Original
1212 people have browsed it

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");
Copy after login
?

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template