最新消息:

PHP代码报错Warning: date_default_timezone_get() expects

gtocms eben 109浏览 0评论

Warning: date_default_timezone_get() expects exactly 0 parameters, 1 given in D:\wamp64\www\dif.php on line 8

Warning: date_default_timezone_get(): 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. in C:wwwu4v.cnsettings.php on line 121

看字面意思,就是时区设置不正确造成的。
说说怎么解决
方法1:
修改php.ini
设置date.timezone = “Asia/Shanghai”
重启环境
方法2:
在需要的PHP页面添加date_default_timezone_set(“PRC”);
方法3:
在需要的PHP页头加上ini_set(‘date.timezone’,’Asia/Shanghai’);

 

转载请注明:落伍老站长 » PHP代码报错Warning: date_default_timezone_get() expects

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址