Warning: date() :It is not safe to rely on the system's timezone settings
在执行php文件时会出现下面的错误:
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 'UTC' for '8.0/no DST' instead in /usr/local/apache/htdocs/test.php on line 50 。
Cause:
这是因为PHP所取的时间是格林威治标准时间,所以和你当地的时间会有出入格林威治标准时间和北京时间大概差8个小时左右,我们可以按照下面的方法解决。
解决办法:
1、在页头使用date_default_timezone_set()设置我的默认时区为北京时间,即
<?php
date_default_timezone_set("PRC");
?>就可以了。
2、在php.ini中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。
转载于:https://www.cnblogs.com/chuangshaogreat/p/7878982.html
Warning: date() :It is not safe to rely on the system's timezone settings相关推荐
- Warning:It is not safe to rely on the system's timezone settings
今天在本地运行PHP脚本文件没有问题,但是传到线上测试服务器以后,报了如下错误:<b>Warning</b>: date() [<a href='function.dat ...
- 问题解决: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 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 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 ...
- 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 *req ...
- 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 echo输出多了 date(): It is not safe to rely on the system‘s timezone settings
原因 如果使用PHP5.3以上版本时,如果没有正确的配置php.ini就会出现PHP日期函数的错误.以前很多旧的PHP编程教程没有说到这个问题,所以不少读者会觉得困惑,下面笔者为大家讲述解决这个问题的 ...
- 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 ...
最新文章
- 英文字典设计c语言代码,一种简单的英文词典排版系统
- [转]asp.net权限认证:HTTP基本认证(http basic)
- AI:一个20年程序猿的学习资料大全—人工智能之AI/机器学习/深度学习/计算机视觉/Matlab大赛——只有你不想要的,没有你找不到的
- javaee和javaee_JavaEE概念简介
- uvm 形式验证_IC设计职位详解之“数字验证工程师”就业必学课程
- GCD之后台程序运行
- [转载] python判断字符串中包含某个字符串_干货分享| Python中最常用的字符串方法
- python文件拷贝到其他盘符_Python:文件操作技巧(File operation)
- 修炼成QTP高手的十个步骤
- oracle报错12516,Oracle连接数太多报错-ORA-12516异常
- K650c + Ubuntu 15.04无法正常关机,重启
- 运维是做什么的?史上最全互联网Linux工作规划!十分钟找到linux运维工程师职业方向!...
- Linux基础知识-1
- Oracle 常见错误总结及问题解决方法
- 微擎url模式解读_微擎常用开发文档
- greasemonkey_Greasemonkey –在任何页面上执行自定义JavaScript
- 什么是HTAP 阿里云上实现
- c++ 复合类型 读书笔记(二)
- 关于idea+mybatis+springcloud+swagger2+Apollo 踩得小坑
- 视网膜血管分割方法整理