您当前的位置: 首页 >  ar

壹小俊

暂无认证

  • 5浏览

    0关注

    885博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use

壹小俊 发布时间:2019-04-09 13:55:41 ,浏览量:5

运行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 the timezone 'UTC' for now, but please set date.timezone to select
 your 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: 在页头加上设置时区ini_set('date.timezone','Asia/Shanghai');  

关注
打赏
1664335782
查看更多评论
立即登录/注册

微信扫码登录

0.0837s