我尝试生成中指定的完整时区集http://php.net/manual/en/timezones.php http://php.net/manual/en/timezones.php(UTC 除外)使用以下代码:
$zones = timezone_identifiers_list();
print_r($zones);
但这个列表似乎跳过了约 50 个地区,例如:太平洋/萨摩亚(与http://php.net/manual/en/timezones.php http://php.net/manual/en/timezones.php)
我们做错了什么?
phpinfo() 显示:
PHP Version 5.3.4
Apache Version Apache/2.2.3 (CentOS)
$ uname -r
2.6.18-028stab070.14
Edit #2
date
date/time support enabled
"Olson" Timezone Database Version 0.system
Timezone Database internal
Default timezone UTC
您的时区数据库可能不是最新的。
尝试点击底部的链接支持的时区列表 http://php.net/manual/en/timezones.php page :
最新版本的时区
数据库可以通过 PECL 安装 »时区数据库 http://pecl.php.net/get/timezonedb.
评论后编辑:要更新时区数据库,就像您在 Linux 系统上一样,您可以使用pecl
命令(我刚刚在我的 Ubuntu 机器上尝试过这个) :
pecl upgrade timezonedb
这将下载新版本并进行编译。
然后,如果您启用新的timezonedb
扩展,您的 PHP 应该使用最新的数据库:
php -dextension=timezonedb.so -i | grep Timezone
"Olson" Timezone Database Version => 2011.5
Timezone Database => external
Alternative Timezone Database => enabled
Timezone Database Version => 2011.5
如果我尝试不启用该新扩展,我会得到与之前相同的结果:
php -i | grep Timezone
"Olson" Timezone Database Version => 0.system
Timezone Database => internal
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)