在Laravel 5.4中找不到类'NumberFormatter' [英] Class 'NumberFormatter' not found in Laravel 5.4

查看:252
本文介绍了在Laravel 5.4中找不到类'NumberFormatter'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用PHP的intl扩展名将金额转换为单词.例如

I'm trying to use PHP's intl extension to convert amount into words. For example,

1450->一百四十五

1450 -> One Thousand Four Hundred and Fifty

我正在使用在XAMPP 3.2.2服务器和PHP 5.6.24上运行的Laravel 5.4.

I'm using Laravel 5.4 that runs on XAMPP 3.2.2 server with PHP 5.6.24.

就像在类似问题中提到的那样,我已经通过取消注释PHP.ini文件中的行为extension=ext/php_intl.dll并启用了intl PHP扩展,然后重新启动了服务器.

As mentioned in similar questions, I've already enabled the intl PHP extension by uncommenting the line as extension=ext/php_intl.dll in PHP.ini file and restarted my server after.

 $inWords = new \NumberFormatter('en', \NumberFormatter::SPELLOUT);
 echo $inWords->format(1450);

产生错误:

FatalErrorException:找不到类'NumberFormatter'

FatalErrorException: Class 'NumberFormatter' not found

我猜想这与Laravel无关,但与PHP无关.有人知道解决问题的办法吗?谢谢您的宝贵时间.

I'm guessing this doesn't have anything to do with Laravel but PHP. Anyone know the solution to the problem? Thanks for your time.

推荐答案

您必须通过取消注释该行来在php.ini中启用扩展名

You have to enable the extension in your php.ini by uncommenting the line

;extension=php_intl.dll

这篇关于在Laravel 5.4中找不到类'NumberFormatter'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆