Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use
运行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相关推荐
- 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 ...
- 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 ...
- 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 ...
- 解决php报错Warning: date(): It is not safe to rely on the system's timezone settings
只需要在php里面加入下面一句代码即可: date_default_timezone_set("PRC"); 这个是设置时区的意思.
- 问题解决: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 ...
- php echo输出多了 date(): It is not safe to rely on the system‘s timezone settings
原因 如果使用PHP5.3以上版本时,如果没有正确的配置php.ini就会出现PHP日期函数的错误.以前很多旧的PHP编程教程没有说到这个问题,所以不少读者会觉得困惑,下面笔者为大家讲述解决这个问题的 ...
- 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. ...
- 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 ...
- Warning:It is not safe to rely on the system's timezone settings
今天在本地运行PHP脚本文件没有问题,但是传到线上测试服务器以后,报了如下错误:<b>Warning</b>: date() [<a href='function.dat ...
最新文章
- java 线程分配_Java多线程原子引用分配
- SDK目录结构和adb工具及命令介绍
- 微信小程序使用template模板
- 综合时如何插入scan_三综合环境试验箱维修时如何做出正确判断?
- python(1) - 数据类型和变量
- VS集成Qt开发入门(简易时间显示)
- SignalR--Web客户端
- [置顶] Android adb root权限
- DLNg第三周:序列模型和注意力机制
- adb uninstall
- 小手的图标css,CSS中cursor属性给标签加上小手形状
- 冷冻水和冷却水的区别
- 调侃python的段子_杠精的段子 讽刺调侃杠精的说说句子
- Python函数式编程 及案例
- 租车新玩法 神州租车打造行业标杆
- Line APP端协议登录、群发、拉群功能
- 面试过程中经常会问到的职业规划,该如何作答
- Qt中Q_NULLPTR的作用
- tf.range详解
- Java Agent:通灵之术