PHP调用Jpgraph时报错
PHP程序报错如下,有人知道该怎么解决么?PHPWarning:strftime():Itisnotsafetorelyonthesystem'stimezonesett...
PHP程序报错如下,有人知道该怎么解决么?
PHP Warning: strftime(): 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 /usr/share/php/jpgraph-4.2.0/src/jpgraph.php on line 403 展开
PHP Warning: strftime(): 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 /usr/share/php/jpgraph-4.2.0/src/jpgraph.php on line 403 展开
1个回答
展开全部
出问题的原因:date(),依靠系统的时区设置是不安全的。 您*必须*使用date.timezone设置或date_default_timezone_set()函数。 如果您使用这些方法中的任何一种,并且仍然收到此警告,则很可能是拼写错误的时区标识符。 我们现在选择了“UTC”时区,但请设置date.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、在你的php页头加上设置时区ini_set('date.timezone','Asia/Shanghai');
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询