当尝试在我的 PHP 8.1 alpine docker 容器中格式化货币时,我总是得到默认区域设置 (en_US)。
\n$ docker run -it --rm php:8.1-fpm-alpine /bin/ash\n# apk update && apk add icu-dev\n# docker-php-ext-configure intl && docker-php-ext-install intl\n# php -a\n> $formatter = new NumberFormatter('nl_NL', NumberFormatter::CURRENCY);\n> echo $formatter->getLocale();\nen_US\n> echo $formatter->format(1234.567);\n\xe2\x82\xac1,234.57\nRun Code Online (Sandbox Code Playgroud)\n我期望 getLocale() 返回 nl_NL 和 format 返回 \xe2\x82\xac1.234,57。
\n如果我尝试 locale en_GB,getLocale() 确实返回 en_GB。
\n也欢迎任何有关编写更好问题的建议。
\n