gpt4 book ai didi

php - money_format() 不显示货币

转载 作者:可可西里 更新时间:2023-11-01 12:47:34 26 4
gpt4 key购买 nike

我正在尝试使用 money_format 函数。

<?php

$number = 1299.46;

setlocale(LC_MONETARY, 'en_US');
echo money_format('%i', $number); // Outputs 1299.46

它应该打印 $ 符号还是 USD ?

我在 linux 主机上。

谢谢

最佳答案

如果语言环境无效,

money_format 将无法正常工作。

例如,在 Debian 上,“en_US”不是有效的语言环境 - 您需要“en_US.UTF-8”或“en_US.ISO-8559-1”。

关于php - money_format() 不显示货币,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30956914/

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