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

PHP(外文名: Hypertext Preprocessor,中文名:“超文本预处理器”)是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点,入门门槛较低,易于学习,使用广泛,主要适用于Web开发领域。PHP的文件后缀名为php。

Warning:strtotime(): 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 'Asia/Chongqing' for 'CST/8.0/no DST' instead in /data/httpd/www/Suvan/a.php

解决方法: 1、在php.ini配置文件中修改timezone的配置

# vim /usr/local/php/etc/php.ini
date.timezone = "PRC"
# env-update
# source /etc/profile

2、在出现错误提示的php文件中添加date_default_timezone_set('PRC');

注:百度查阅资料说是这两个方法任选其一就可,但经我测试php5.6.25,必须两个方法同时使用,才不会再出现错误提示

评论

评论正在提交中...请稍后
评论提交成功...