运行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 getting this warning, you most likely misspelled
the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to selectyour timezone.

解决办法:

方法1:
(最好的方法)在php.ini里加上找到date.timezone项,去掉前面的";",添加设置date.timezone = "Asia/Shanghai",北京的时间也写成上海那个。

重启环境,然后出现如下问题:

Warning: date(): Invalid date.timezone value 'Asia/Beijing', we selected the timezone 'UTC' for now. in D:\Tomcat\apache-tomcat-7.0.77\webapps\webOne\qshxxkj\WEB-INF\php-bin\Wxpay\example\h5.php on line 16
在php.ini中date.timezone = "Asia/Shanghai",加上如下这句话即可:
date_default_timezone_set('UTC');

重启服务即可。

方法2:
在需要用到这些时间函数的时候,在页面添加date_default_timezone_set("PRC");

方法3:
在页头加上设置时区ini_set('date.timezone','Asia/Shanghai');

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use相关推荐

  1. PHP Warning: date(): It is not safe to rely on the system’s timezone settings

    如下错误: PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *requir ...

  2. PHP Warning: date(): It is not safe to rely on the system's timezone settings.

    OSSEC安装结束后运行,运行以下命令却抛错 cat /opt/ossec/logs/alerts/alerts.log 具体抛错内容: ** Alert 1468897672.2164786: ma ...

  3. PHP Warning: date(): It is not safe to rely on the system's timezone settings

    在用PHP5.3以上的PHP版本时,只要是涉及时间的会报一个 "PHP Warning: date() [function.date]: It is not safe to rely on ...

  4. 解决php报错Warning: date(): It is not safe to rely on the system's timezone settings

    只需要在php里面加入下面一句代码即可: date_default_timezone_set("PRC"); 这个是设置时区的意思.

  5. 问题解决:Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. You.

    在我们使用到时间函数data()时,有时候会弹出下面这种错误: "PHP Warning: date() [function.date]: It is not safe to rely on ...

  6. php echo输出多了 date(): It is not safe to rely on the system‘s timezone settings

    原因 如果使用PHP5.3以上版本时,如果没有正确的配置php.ini就会出现PHP日期函数的错误.以前很多旧的PHP编程教程没有说到这个问题,所以不少读者会觉得困惑,下面笔者为大家讲述解决这个问题的 ...

  7. php : Warning: strftime(): It is not safe to rely on the system's timezone settings.

    使用 Smarty 的时候出现这种警告: Warning: strftime(): It is not safe to rely on the system's timezone settings. ...

  8. php Warning: phpinfo(): It is not safe to rely on the system's timezone settings.解决方法

    安装php后,使用phpinfo();查看信息,有Warning: phpinfo(): It is not safe to rely on the system's timezone setting ...

  9. Warning:It is not safe to rely on the system's timezone settings

    今天在本地运行PHP脚本文件没有问题,但是传到线上测试服务器以后,报了如下错误:<b>Warning</b>: date() [<a href='function.dat ...

最新文章

  1. java 线程分配_Java多线程原子引用分配
  2. SDK目录结构和adb工具及命令介绍
  3. 微信小程序使用template模板
  4. 综合时如何插入scan_三综合环境试验箱维修时如何做出正确判断?
  5. python(1) - 数据类型和变量
  6. VS集成Qt开发入门(简易时间显示)
  7. SignalR--Web客户端
  8. [置顶] Android adb root权限
  9. DLNg第三周:序列模型和注意力机制
  10. adb uninstall
  11. 小手的图标css,CSS中cursor属性给标签加上小手形状
  12. 冷冻水和冷却水的区别
  13. 调侃python的段子_杠精的段子 讽刺调侃杠精的说说句子
  14. Python函数式编程 及案例
  15. 租车新玩法 神州租车打造行业标杆
  16. Line APP端协议登录、群发、拉群功能
  17. 面试过程中经常会问到的职业规划,该如何作答
  18. Qt中Q_NULLPTR的作用
  19. tf.range详解
  20. Java Agent:通灵之术

热门文章

  1. 海量数据处理面试题/大文件问题
  2. 索爱手机android系统,索爱正式发布Android系统Walkman音乐手机
  3. Matlab .m脚本文件
  4. 极化强度矢量和磁化强度矢量
  5. python内置属性与内置方法
  6. uni-app移动端开发技巧总结
  7. 开发一个简单APP的流程及记事本案例(Android Studio)
  8. JDK1.8 邮戳锁(StampedLock)知识点整理以及示例
  9. 网页h5适配iPhoneX
  10. 《皇室战争》游戏设计师:顶级卡牌竞技游戏的‘平衡之道’