安装了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" );
php 5.3的升级引起的一些非兼容问题 之一
最新推荐文章于 2025-12-06 09:28:08 发布
本文介绍了解决安装PHP5.3后出现的日期函数警告的方法,包括配置php.ini文件来设置默认时区和使用date_default_timezone_set()函数。
1548

被折叠的 条评论
为什么被折叠?



