首页 > Web开发 > 详细

PHP date()函数警告: It is not safe to rely on the system解决方法

时间:2017-02-21 00:33:15      阅读:164      评论:0      收藏:0      [点我收藏+]

PHP Warning:  date(): It is not safe to rely on the system‘s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still gett
ing this warning, you most likely misspelled the timezone identifier. We selected ‘Asia/Chongqing‘ for ‘CST/8.0/no DST‘ instead in /data0/htdocs/www.qttc.net/function/function.php on line 542
 

大体是说timezone没有设置,在中国使用的是格林+8小时,所以需要设置一下。
 
第一种

在页面头部加入以下语句

date_default_timezone_set("PRC");

这种方法有个缺点,就是所有的页面都得添加

 

第二种

在php.ini里找到date.timezone这行,把值改成PRC,如date.timezone = PRC。如果没有这一行直接加上就好。最后重启WEB服务器与PHP即可。

http://www.jb51.net/article/54044.htm

PHP date()函数警告: It is not safe to rely on the system解决方法

原文:http://www.cnblogs.com/gengyi/p/6422077.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!