源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2021-02-05 07:21 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:PHP date()函数警告: It is not safe to rely on the system解决方法
近来总是有系统邮件提示,开始没在意,后来不断提示就看了一下。提示以下信息
[u]复制代码[/u] 代码如下:
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小时,所以需要设置一下。 [b]第一种[/b] 在页面头部加入以下语句
[u]复制代码[/u] 代码如下:
date_default_timezone_set("PRC");
这种方法有个缺点,就是所有的页面都得添加 [b]第二种[/b] 在php.ini里找到date.timezone这行,把值改成PRC,如date.timezone = PRC。如果没有这一行直接加上就好。最后重启WEB服务器与PHP即可。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部