php action 未定义,php – 致命错误:调用未定义的函数money_format()[closed]

每次我尝试运行这个代码,都会有一个消息说:

Fatal error: Call to undefined function money_format()

有这个问题的线是:

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

$cartTotal = money_format("%10.2n", $cartTotal);

你能解释一下这个原因吗?

$cartOutput = "";

$cartTotal = "";

$pp_checkout_btn = '';

$product_id_array = '';

if (!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1) {

$cartOutput = "

Your shopping cart is empty

";

} else {

// Start PayPal Checkout Button

$pp_checkout_btn .= '

';

// Start the For Each loop

$i = 0;

foreach ($_SESSION["cart_array"] as $each_item) {

$item_id = $each_item['item_id'];

$sql = mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1");

while ($row = mysql_fetch_array($sql)) {

$product_name = $row["product_name"];

$price = $row["price"];

$details = $row["details"];

}

$pricetotal = $price * $each_item['quantity'];

$cartTotal = $pricetotal + $cartTotal;

setlocale(LC_MONETARY, "en_US");

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

// Dynamic Checkout Btn Assembly

$x = $i + 1;

$pp_checkout_btn .= '

';

// Create the product array variable

$product_id_array .= "$item_id-".$each_item['quantity'].",";

// Dynamic table row assembly

$cartOutput .= "

";

$cartOutput .= '

' . $product_name . ' ' . $product_name. '';

$cartOutput .= '

' . $details . '';

$cartOutput .= '

$' . $price . '';

$cartOutput .= '

';

//$cartOutput .= '

' . $each_item['quantity'] . '';

$cartOutput .= '

' . $pricetotal . '';

$cartOutput .= '

';

$cartOutput .= '

';

$i++;

}

setlocale(LC_MONETARY, "en_US");

$cartTotal = money_format("%10.2n", $cartTotal);

$cartTotal = "

Cart Total : ".$cartTotal." USD
";

// Finish the Paypal Checkout Btn

$pp_checkout_btn .= '

';

}

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值