kri*_*a89 2 php currency-formatting server
我正在尝试将数字字符串转换为印度数字系统(Lakhs格式),为此我用Google搜索并尝试以下代码.
这个代码部分在linux共享托管服务器上测试时给了我正确的输出,但它不能在windows共享主机中工作,不确定这是否是由于某些版本问题,任何线索是否有任何替代setlocate?
$amount = '120090';
setlocale(LC_MONETARY, 'en_IN');
$amount = money_format('%!i', $amount);
print $amount;
Run Code Online (Sandbox Code Playgroud)
这个函数在windows上不起作用,doc说:
仅当系统具有strfmon功能时才定义函数money_format().例如,Windows没有,因此在Windows中未定义money_format().
一种替代方法是intl(需要通过php.ini启用)库和numberFormatter类参见示例:
| 归档时间: |
|
| 查看次数: |
1000 次 |
| 最近记录: |