天天看点

php timezone获取错误

在测试ECSHOP网站的时候,在执行安装时出现timezone错误,错误内容大概如下:

 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' for 'EEST/3.0/DST' instead in /path/to/my/www/wp-includes/functions.php on line 35

这是贴的别人的错误,我的错误在经过下面改正后通过了,也没记下来

错误原因:php认为你的timezone是不可靠的。以下是某大侠Dan.LaSota提供的方法,可能不能解决你的问题,仅作参考:

And thank you for this ,Dan.

According to the article:

<a href="http://wordpress.org/support/topic/php-530-amp-wp-28-it-is-not-safe-to-rely-on-the-systems-timezone">http://wordpress.org/support/topic/php-530-amp-wp-28-it-is-not-safe-to-rely-on-the-systems-timezone</a>

Another way to approach this is to let php know what your time zone is. You can edit your php.ini file and put in the following line:

date.timezone = "Asia/Chongqing"