dtiopy6088 2011-05-10 06:05
浏览 110
已采纳

PHP错误“依赖系统的时区设置是不安全的。”使用$ _GET时

I'm getting the error that many have seen when upgrading from PHP 5.2.9 to PHP 5.3.0, but oddly, the error is showing up as the result of a reference to a $_GET variable, not anything to do with a timezone setting.

Here's the error:

Warning: date_default_timezone_get(): 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.

Has anyone else seen this same thing, and found a way to resolve it without simply changing the error_reporting level?

Thanks.

  • 写回答

2条回答 默认 最新

  • duanqie5741 2011-05-10 06:11
    关注

    I also had that error, when I upgraded from PHP 5.2 to PHP 5.3. I solved that by setting the corresponding server timezone in my php.ini:

    date.timezone = "Europe/Berlin"
    

    Following http://php.net/manual/de/function.date-default-timezone-set.php, since PHP 5.3 a E_WARNING is thrown if the timezone was not set.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部