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

为什么会出现此错误

码:

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

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...