`
happmaoo
  • 浏览: 4338520 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

php 5.3的升级引起的一些非兼容问题 之一

阅读更多

安装了php 5.3之后,如果之前的代码遇到如下的问题:

Warning: date() [function.date]: 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 'Europe/Helsinki'

等等之类的,有如下解决办法:

1. 比较根本的,不需要修改自己代码的,需要设置php.ini中的:

date.timezone = "Europe/Berlin"

具体是设置服务器的默认时区,可以参考:
http://php.net/manual/en/timezones.php

2. 另一种方法,如果没有编辑php.ini的权限的话,可以在代码中添加:

date_default_timezone_set( "Europe/Berlin" );


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics