3

我突然在我已经完成的网站上收到以下错误,到目前为止一直运行良好:

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在很多地方都使用这种格式,并且在每个地方都会抛出错误。

4

2 回答 2

7

正如错误所说,您要么需要在代码中使用date_default_timezone_set('Antarctica/Macquarie');or指定时区,要么在.ini_set('date.timezone', 'Antarctica/Macquarie');date.timezonephp.ini

于 2011-07-17T22:42:35.307 回答
0

你能确认$month,$day$year是 INT - 甚至不是 NULL 吗?

还要查看date_default_timezone_set()

于 2011-07-17T22:43:50.113 回答