为什么会出现此错误?
码:
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 hasstrfmon
capabilities. For example,Windows does not,somoney_format()
is
undefined in Windows.
money_format()基本上是作为手动状态的C库函数strfmon()的包装.
如果你查看评论,那就是an implementation by Rafael M. Salvioni.值得一试.您可以使用function_exists()检查是否已经定义.
this StackOverflow question的答案给出了更多的(甚至更好的)替代方案(thx danielson317).