我突然在我所做的一个网站上得到了以下错误,到目前为止它工作得很好:
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,0,0,$month,$day,$year);这里有什么问题?我怎样才能快速消除这些错误呢?我在很多地方都在使用这种格式的mktime,而且每个地方都会抛出一个错误。
发布于 2011-07-18 06:42:35
如错误所示,您需要在代码中使用date_default_timezone_set('Antarctica/Macquarie');或ini_set('date.timezone', 'Antarctica/Macquarie');指定时区,或者在php.ini中定义date.timezone。
发布于 2011-07-18 06:43:50
你能确认$month、$day和$year是整型的甚至不是NULL吗?
也可以研究一下date_default_timezone_set()
https://stackoverflow.com/questions/6727270
复制相似问题