加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 在money_format函数中发生致命错误

发布时间:2020-12-13 16:39:48 所属栏目:PHP教程 来源:网络整理
导读:为什么会出现此错误? 码: setlocale(LC_MONETARY,"en_US");$pricetotal = money_format("%10.2n",$pricetotal); 服务器详情. Apache Version : 2.2.21 PHP Version : 5.3.8 我收到以下错误 Fatal error: Call to undefined function money_format() 从 man
为什么会出现此错误?

码:

setlocale(LC_MONETARY,"en_US");
$pricetotal = money_format("%10.2n",$pricetotal);

服务器详情.

Apache Version : 2.2.21  
PHP Version : 5.3.8

我收到以下错误

Fatal error: Call to undefined function money_format()
从 manual:

The function money_format() is only defined if the system has strfmon
capabilities. For example,Windows does not,so money_format() is
undefined in Windows.

money_format()基本上是作为手动状态的C库函数strfmon()的包装.

如果你查看评论,那就是an implementation by Rafael M. Salvioni.值得一试.您可以使用function_exists()检查是否已经定义.

this StackOverflow question的答案给出了更多的(甚至更好的)替代方案(thx danielson317).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读