intl的例子不适合我


The intl example does not work for me

从文档中运行下面的示例对我来说返回false(本页中的其他示例也有相同的问题)。是bug吗?

$fmt = new IntlDateFormatter(
    'en_US',
    IntlDateFormatter::FULL,
    IntlDateFormatter::FULL,
    'America/Los_Angeles',
    IntlDateFormatter::GREGORIAN
);
echo 'First parsed output is ' . $fmt->parse('Wednesday, December 20, 1989 4:00:00 PM PT');

echo $fmt->getErrorMessage(); // return: U_PARSE_ERROR

parse方法似乎需要IntlDateFormatter构造函数的format参数

您可能需要使用setPattern来设置pattern, setPattern可以获取这里所说的模式

这里也有同样的问题。在我的例子中,php国际化扩展没有安装: