How to format currency sign in Yii2 after the value?

一曲冷凌霜 提交于 2019-12-10 13:48:10

问题


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.


回答1:


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.




回答2:


here i am assuming that you are using span for value and currency. you can check the fiddle.

html :

<span>10 000,00</span>
<span class="currency">€</span>

CSS :

.currency{
    float:  left;
}

jsfiddle



来源:https://stackoverflow.com/questions/32992414/how-to-format-currency-sign-in-yii2-after-the-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!