[英]NumberFormatter Not Found in Laravel 5.5
I have a fairly basic setup to use the NumberFormatter
inside PHP like so:我有一个相当基本的设置来使用 PHP 中的
NumberFormatter
,如下所示:
$percent_formatter = new \NumberFormatter('en_US', NumberFormatter::PERCENT);
For some reason, I get a Laravel error back saying the class can't be found.出于某种原因,我收到一个 Laravel 错误,说找不到该类。 I looked through SO first (this was helpful: Class 'NumberFormatter' not found in Laravel 5.4 ) and found multiple links on how to set it up, but where I get confused is that it is setup - when I run
php -m
, I can see intl
listed as a loaded extension and the DLL was already on my box, so this doesn't make sense.我首先查看了 SO(这很有帮助: 在 Laravel 5.4 中找不到 Class 'NumberFormatter' )并找到了有关如何设置它的多个链接,但我感到困惑的是它已设置 - 当我运行
php -m
,我可以看到intl
列为已加载的扩展,并且 DLL 已经在我的盒子上,所以这没有意义。
Any ideas?有任何想法吗? I'm running IIS on Windows 10 and everything else within Laravel works, except this.
我在 Windows 10 上运行 IIS,除此之外,Laravel 中的其他所有内容都可以运行。 Here is the php.ini file:
这是 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
Try changing:尝试改变:
$percent_formatter = new \NumberFormatter('en_US', NumberFormatter::PERCENT);
to:到:
$percent_formatter = new \NumberFormatter('en_US', \NumberFormatter::PERCENT);
with a backslash () added in front of NumberFormatter::PERCENT在 NumberFormatter::PERCENT 前面添加一个反斜杠 ()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.