如何在值后格式化Yii2中的货币符号? [英] How to format currency sign in Yii2 after the value?
本文介绍了如何在值后格式化Yii2中的货币符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在,当我定义了currencyCode 时,货币符号出现在像€10 000,00 这样的值前面,但我希望它像10 000,00€.如何做到这一点?
Right now when I have defined the currencyCode, the currency sign appears in front of the value like €10 000,00, but I'd like to have it like 10 000,00€. How to do that?
目前我在值后单独打印€",但我只是想知道是否有任何方法可以使该过程自动化.
At the moment I'm printing '€' separately after the value, but I'm just wondering if there's any way to automate the process.
推荐答案
我能够通过安装 php5-intl 并使用这种方式解决这个问题
I was able to resolve this issue installing php5-intl and using this way
Yii::$app->formatter->locale = 'et-EE';
echo Yii::$app->formatter->asCurrency(1202.57, 'EUR');
它将根据区域设置更改符号.
It will change the sign according to the locale.
这篇关于如何在值后格式化Yii2中的货币符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文