在写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错误的更多相关文章

  1. 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 ...

  2. 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. ...

  3. mac下apache配置,解决It is not safe to rely on the system's timezone settings.

    之前一直转windows平台下做php,很少遇到问题.现在有了macbook,还在慢慢的熟悉中,搭建php开发环境,熟悉mac系统文档组织还有命令,颇费功夫. 今天我在mac下做一个php的练习,用到 ...

  4. 解决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 ...

  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 ...

  6. 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(): ...

  7. 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* ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. install memcached for ubuntu

    Memcached安装 1.先下载安装libevent 安装 libevent# tar zxvf libevent-1.4.9-stable.tar.gz# cd libevent-1.4.9-st ...

  2. Asp.Net MVC Ajax轮训解决Session失效时间

    这种方法不是太好,对服务器得压力大,由于系统是内部人员使用,业务有比较复杂,所以有些值得需要Session去保存,但是,Session有失效时间. 代码如下: $(function () { func ...

  3. 【第一部分】01Leetcode刷题

    一.二叉树的中序遍历 题目:94. 二叉树的中序遍历.94. Binary Tree Inorder Traversal 解法一: class Solution { public: vector< ...

  4. Windows系统下安装运行Kafka

    一.安装JAVA JDK 1.下载安装包 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151. ...

  5. Dubbo 服务集群容错配置

    Dubbo集群容错是靠配置cluster属性来做 支持改属性的标签为<dubbo:service>,<dubbo:referece>,<dubbo:consumer> ...

  6. 使用docker部署.net core应用

    CentOS 使用VS2017新建一个asp.net core项目 发布web应用程序 使用FTP工具,将程序文件copy到linux上 XShell连上linux并登陆 cd /CoreWebDem ...

  7. 安全测试robots

    http://stock.pingan.com/robots.txt

  8. 两个select一个选中,另一个就没有选中的那个值

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. L1-006 连续因子 (20 分) 模拟

    一个正整数 N 的因子中可能存在若干连续的数字.例如 630 可以分解为 3×5×6×7,其中 5.6.7 就是 3 个连续的数字.给定任一正整数 N,要求编写程序求出最长连续因子的个数,并输出最小的 ...

  10. 038 lock wait timeout exceeded;try restarting transaction

    场景:有两个会话,其中会话1在事务操作,会话2在等待这个事务操作完成,然后会有这个报错产生. 通过查询资料,在这里整理一下. 一:总结timeout参数的作用 1.操作 2.具体解释 1)connec ...