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 D:\PHPWEB\news\file.php on line 17 。这是因为PHP所取的时间是格林威治标准时间,所以和你当地的时间会有出入格林威治标准时间和北京时间大概差8个小时左右,我们可以按照下面的方法解决:
1、在页头使用date_default_timezone_set()设置我的默认时区为北京时间,即 <?php date_default_timezone_set("PRC"); ?>就可以了。
2、在php.ini中设置date.timezone的值为PRC,设置好以后的为:date.timezone=PRC,同时取消这一行代码的注释,即去掉前面的分号就可以了。
PRC:表示The Republic Country OF China
It is not safe to rely on the system's timezone settings错误的更多相关文章
- Warning: strftime(): It is not safe to rely on the system's timezone settings.
当运行程序时,会出现如下警告: Warning: strftime(): It is not safe to rely on the system's timezone settings. You a ...
- 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. ...
- mac下apache配置,解决It is not safe to rely on the system's timezone settings.
之前一直转windows平台下做php,很少遇到问题.现在有了macbook,还在慢慢的熟悉中,搭建php开发环境,熟悉mac系统文档组织还有命令,颇费功夫. 今天我在mac下做一个php的练习,用到 ...
- 解决php的“It is not safe to rely on the system’s timezone settings”问题
PHP调试的时候出现了警告: It is not safe to rely on the system解决方法,其实就是时区设置不正确造成的,本文提供了3种方法来解决这个问题. 实 际上,从PHP 5 ...
- 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: strtotime(): It is not safe to rely on the system's timezone settings
warning: strtotime(): It is not safe to rely on the system's timezone settings warning: strtotime(): ...
- date(): It is not safe to rely on the system’s timezone settings.
在执行php脚本时出现的错误: date(): It is not safe to rely on the system’s timezone settings.You are *required* ...
- yii2定时任务不执行,报错PHP date调用警告:It is not safe to rely on the system's timezone settings
It is not safe to rely on the system's timezone settings 在写php程序中有时会出现这样的警告:PHP Warning: date(): It ...
- Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use ...报错
错误截图 Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* t ...
随机推荐
- MSTM年底总结
项目简介 做完这个项目,自己也做了测试,功能是正常可以使用的,暂时还没有上线,这个项目是用来卖课的,我自己做的是各个种类课程的展示,登录认证,还有各个接口,还有支付环节,还有微信推送消息,加入他们要买 ...
- Java接口自动化测试之HTTPClient学习(四)
pom.xml 文件中dependency <dependencies> <dependency> <groupId>org.testng</groupId ...
- ZOJ 4057 XOR Clique(位运算)
XOR Clique BaoBao has a sequence a1,a2,...,an. He would like to find a subset S of {1,2,...,n} s ...
- python 0007
#coding='utf-8'# import re import os def get_list(): list_file=[] for f in os.listdir(): if f.endswi ...
- 现在k8s新版里,如何在每个node上运行一个带privileged的daemonset
以前,我们会在kubelet上加--allow-prividged启动参数来实现. 而现在,更推荐的是用pod secureity policy来实现.前面的那种方式以后会被废弃. https://k ...
- java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
1.启动hive的时候出现这个问题,报错如下所示: [hadoop@slaver1 conf]$ hive Logging initialized -cdh5.-cdh5.3.6.jar!/hive- ...
- A - Exposition CodeForces - 6E
题目链接:https://vjudge.net/contest/202699#problem/A 题意 给一个n个元素的序列,从中挑出最长的子序列,要求子序列中元素差的最大值不超过k.问有几个最长子序 ...
- 配置文件——节点<machineKey>的作用,强随机生成
<machineKey>这个节允许你设置用于加密数据和创建数字签名的服务器特定的密钥.ASP.NET自动使用它来保护表单验证Cookie,你也可以将它用于受保护的视图状态数据.同时,这个密 ...
- cropper.js图片裁剪
最近做电子名片的项目,可是个人照片展示上出现了 用户上传的图片尺寸严重失调,所以要求进行图片裁剪,再此我对图片裁剪进行调研 还不太成熟 以后再改 这个实现的原理是 前台获取到 坐标 图片的尺寸 原图文 ...
- 框架MyBatis
ByBatis MyBatis是Apache的一个开源项目iBatis,iBatis3.x 正式更名为MyBatis ,代码于2013年11月迁移到Github.它是一个基于Java的持久层框架(连数 ...