我有一个相当基本的设置来使用PHP中的NumberFormatter
,如下所示:
$percent_formatter = new \NumberFormatter('en_US', NumberFormatter::PERCENT);
出于某种原因,我收到一个Laravel错误,说找不到该课程。我首先查看了SO(这很有帮助:Class 'NumberFormatter' not found in Laravel 5.4)并找到了关于如何设置它的多个链接,但我感到困惑的是它已经设置 - 当我运行php -m
时,我可以看到intl
列为加载的扩展名,DLL已经在我的框中,所以这没有意义。
有什么想法吗?我在Windows 10上运行IIS,Laravel中的其他所有内容都可以运行,除此之外。这是php.ini文件:
[WebPIChanges]
error_log = "C:\WINDOWS\temp\PHP71x64_errors.log"
upload_tmp_dir=C:\WINDOWS\temp
session.save_path=C:\WINDOWS\temp
cgi.force_redirect=0
cgi.fix_pathinfo=1
fastcgi.impersonate=1
fastcgi.logging = 1
max_execution_time=300
date.timezone=America/New_York
extension_dir="C:\Program Files\PHP\v7.1\ext\"
[ExtensionList]
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_curl.dll
extension=php_exif.dll
extension=php_xmlrpc.dll
extension=php_openssl.dll
extension=php_soap.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_imap.dll
extension=php_tidy.dll
extension=php_intl.dll
[PHP_WINCACHE]
extension=php_wincache.dll
答案 0 :(得分:1)
尝试更改:
$percent_formatter = new \NumberFormatter('en_US', NumberFormatter::PERCENT);
收件人:
$percent_formatter = new \NumberFormatter('en_US', \NumberFormatter::PERCENT);
在NumberFormatter :: PERCENT前面添加反斜杠()