longpan 发表于 2017-3-25 06:15:09

PHP默认时区设置

  <a href='function.strtotime'>function.strtotime</a>]: 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。
页: [1]
查看完整版本: PHP默认时区设置