How to format currency sign in Yii2 after the valu

2019-06-21 08:34发布

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.

2条回答
劫难
2楼-- · 2019-06-21 09:00

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.

查看更多
\"骚年 ilove
3楼-- · 2019-06-21 09:00

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

查看更多
登录 后发表回答