1
  <?php
    $f = new NumberFormatter("en", NumberFormatter::SPELLOUT);
    echo ucwords($f->format($TotalCredit));
  ?>

我正在使用此代码将数字转换为字符串。这在本地工作正常,但是当我将它上传到实时服务器时,它会给出一个错误,提示“找不到类'NumberFormatter'”。

错误信息

我使用的服务器的 PHP 版本是 5.6.16。在取消注释它运行的行后在本地服务器中,extension=ext/php_intl.dll但为什么我在实时服务器中收到此错误?

4

1 回答 1

2

问题是使用该类所需的扩展在 Live Server 上不可用。

必须extension=ext/php_intl.dllLive Server 上进行。

php.ini如果您在 Live Server 上找不到,我可以为您提供 2 个选项:

  1. /etc/php/看看里面有没有php.ini
  2. 联系您的 Live Server 上的支持人员并要求他们启用php_intl.dll作为扩展程序。
于 2016-06-18T07:41:20.253 回答