PHP Mktime错误

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了PHP Mktime错误脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我突然在我已经完成的网站上收到以下错误,到目前为止工作正常

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.

脚本宝典总结

以上是脚本宝典为你收集整理的PHP Mktime错误全部内容,希望文章能够帮你解决PHP Mktime错误所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。