Yii2 Currency Formatter 在小数点后设置 4 个小数
Yii2 Currency Formatter set 4 fractions after decimal
我想设置小数点后4位小数,
for example : Yii::$app->formatter->asCurrency($model->amount)
current output is : $ 65.58
expected output is : $ 65.5765
我试过这个 ,但我收到错误 "Class 'NumberFormatter' not found"。
如何在我的主配置文件中使用以下属性,这些属性在 Formatter class
中提到
[
NumberFormatter::MIN_FRACTION_DIGITS => 0,
NumberFormatter::MAX_FRACTION_DIGITS => 2,
]
此属性仅在安装PHP intl extension时生效。安装 intl
和 class NumberFormatter
将可用。其余的就像您的配置一样。
我想设置小数点后4位小数,
for example : Yii::$app->formatter->asCurrency($model->amount)
current output is : $ 65.58
expected output is : $ 65.5765
我试过这个
如何在我的主配置文件中使用以下属性,这些属性在 Formatter class
中提到 [
NumberFormatter::MIN_FRACTION_DIGITS => 0,
NumberFormatter::MAX_FRACTION_DIGITS => 2,
]
此属性仅在安装PHP intl extension时生效。安装 intl
和 class NumberFormatter
将可用。其余的就像您的配置一样。