【发布时间】:2013-11-22 19:27:26
【问题描述】:
更改服务器后,我收到以下错误...
<b>Warning</b>: date() [<a href='function.date'>function.date</a>]: 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 'America/New_York' for
'EST/-5.0/no DST' instead in <b>/sessions.php</b> on line <b>8001</b>
此错误消息所指的行是...
$date = date('Y-m-d G:i:s');
我不确定它是如何工作的?
那么我如何获取用户的时区,然后将其设置为内置 PHP 变量或与 date() 一起使用?
【问题讨论】:
-
旁注:
$date = $date = date()?重新声明$date? -
“如果您在我的任何内容中看到不直观/愚蠢的内容,请注意它;已被其他人编辑”我认为这里不是这种情况。不知道为什么您的 [code] 被错误地标记为 SO。该错误有什么令人困惑的地方?
-
您可以使用 PHP-GEOIP 获取用户的时区。参考这个链接,希望对php.net/manual/en/intro.geoip.php有帮助