gpt4 book ai didi

php - 在 money_format 函数中出现 fatal error

转载 作者:可可西里 更新时间:2023-10-31 22:42:14 25 4
gpt4 key购买 nike

为什么会出现这个错误?

代码:

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

关于php - 在 money_format 函数中出现 fatal error ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10715658/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com