这段代码在我的开发服务器上运行良好,但是当我在另一台服务器上运行它时,它失败了:
$formatter = new IntlDateFormatter('en-GB', IntlDateFormatter::LONG, IntlDateFormatter::NONE, 'Europe/London');
var_dump($formatter->format(new DateTime('2012-06-01')));
var_dump($formatter->getErrorMessage() . ' ' . $formatter->getErrorCode());
给我:
bool(false)
string(14) "U_ZERO_ERROR 0"
有谁知道为什么?特别奇怪的是它甚至不报告错误(U_ZERO_ERROR 是默认值)。谢谢。
编辑:
为了比较,我在本地得到:
string(11) "1 June 2012"
string(14) "U_ZERO_ERROR 0"
我在其他语言环境中也看到了同样的问题,包括en-US
.