致命错误:找不到类'NumberFormatter'
P粉817354783
P粉817354783 2023-08-16 16:29:06
0
2
354
<p>我已经使用这段完全相同的代码很久了,从来没有出过任何问题。突然间它停止工作了。</p> <p>我在互联网上阅读了关于这个问题的资料,显然你需要安装<code>PHP 5.3或更高版本</code>,以及安装<code>PHP intl</code>插件。我两者都有,但是每当我使用下面的函数时,我仍然收到一个<code>致命错误:找不到类'NumberFormatter'</code>的错误:</p> <pre class="brush:php;toolbar:false;">function format_item($value) { $format = new NumberFormatter('en_US', NumberFormatter::CURRENCY); return $format->formatCurrency($value, 'AUD'); }</pre> <p>此外,这是我<code>php.ini</code>文件的一部分,显示我已经安装了<code>PHP intl</code>插件:</p> <pre class="brush:php;toolbar:false;">[intl] intl.default_locale = fr_FR ; This directive allows you to produce PHP errors when some error ; happens within intl functions. The value is the level of the error produced. ; Default is 0, which does not produce any errors. intl.error_level = E_WARNING</pre> <p>我还在我的<code>php.ini</code>中添加了<code>extension=php_intl.dll</code>,并且它也在我的目录中。</p> <p>为什么我会收到这个错误?</p>
P粉817354783
P粉817354783

全部回复(2)
P粉237029457

这似乎是一个非常奇怪的问题,我通过以下方式解决了它:

我通过这个教程升级了我的Wamp中的PHP。我还更新了php.ini中的时区设置。当我升级后,它没有起作用,所以我恢复回了之前的PHP版本,然后问题就解决了。

我完全不知道这样做为什么能解决问题,但对我来说有效。

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!