Class 'NumberFormatter' not found in Laravel 5.4

狂风中的少年 提交于 2019-12-07 13:59:38

问题


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

1450 -> One Thousand Four Hundred and Fifty

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

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);

yields the error:

FatalErrorException: Class 'NumberFormatter' not found

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.


回答1:


You have to enable the extension in your php.ini by uncommenting the line ;extension=php_intl.dll



来源:https://stackoverflow.com/questions/44095680/class-numberformatter-not-found-in-laravel-5-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!