加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

PHP Mktime错误

发布时间:2020-12-13 21:42:39 所属栏目:PHP教程 来源:网络整理
导读:我突然在我已经完成的网站上收到以下错误,到目前为止工作正常: A PHP Error was encounteredSeverity: WarningMessage: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timez
我突然在我已经完成的网站上收到以下错误,到目前为止工作正常:

A PHP Error was encountered

Severity: Warning

Message: mktime() [function.mktime]: 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 'Antarctica/Macquarie' for 'EST/10.0/no DST' instead

这是有问题的代码:

$stamp=mktime(0,$month,$day,$year);

这是什么问题?如何快速消除这些错误?我在很多地方都使用那种格式的mktime,并且每个地方都会出错.

解决方法

如错误所示,您需要使用date_default_timezone_set(‘Antarctica / Macquarie’)指定时区;或ini_set(‘date.timezone’,’Antarctica / Macquarie’);在您的代码中或在php.ini中定义date.timezone.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读