PHP date()函数警告: It is not safe to rely on the system解决方法
2014-08-20 11:21
537 查看
近来总是有系统邮件提示,开始没在意,后来不断提示就看了一下。提示以下信息
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即可。
您可能感兴趣的文章:
相关文章推荐
- PHP date()函数警告: It is not safe to rely on the system解决方法
- PHP date()函数警告: It is not safe to rely on the system解决方法
- php使用date()函数时,提示的警告
- PHP Warning: date() [function.date]: It is not safe是什么问题
- php之date()函数
- PHP5.2中date()函数显示时间与北京时间相差8小时的解决办法
- PHP5.2中date()函数显示时间与北京时间相差8小时的解决办法
- PHP - Manual手册 - XXII. Date/Time 日期/时间函数 - date格式化一个本地时间/日期
- php date 函数输出的时间相差20小时
- PHP date()函数参数详解
- PHP date函数参数详解
- PHP学习笔记-->009 PHP Date / Time 函数
- php中利用date(),mktime()函数得到当前月的上个月和下个月
- PHP Date() 函数
- PHP中date()函数详细参数
- php的date()函数和time()函数
- 如何用PHP中的date()函数取得当前的确切时间
- php语言date()函数 参数表
- PHP日期格式化 - date()函数
- PHP Warning: date() [function.date]: It is not safe是什么问题