【问题标题】:Yii2 - currency format euroYii2 - 货币格式欧元
【发布时间】:2016-05-11 11:04:45
【问题描述】:

我在配置中有这个:

        'formatter' => [
        'dateFormat' => 'yyyy-MM-dd',
        'decimalSeparator' => ',',
        'thousandSeparator' => '.',
        'currencyCode' => 'EUR',
   ], 

这个打印 €20.000,00 但我想要 20.000,00€(最后是 €)。

谁在 yii2 中做这个?

【问题讨论】:

    标签: yii2 yii2-advanced-app


    【解决方案1】:

    The main source:

    你应该设置这个配置:

    Yii::$app->formatter->locale = 'et-EE';
    

    这样就够了。

    【讨论】:

      【解决方案2】:

      这仅仅意味着您需要在您的服务器上启用 PHP 国际化扩展(又名 intl):http://php.net/manual/en/book.intl.php

      阅读更多关于\yii\i18n\Formatter::asCurrency() 的信息:

      此功能不需要安装 PHP intl 扩展即可工作,但强烈建议安装它以获得良好的格式化效果。

      阅读更多关于PHP internationalization extension installation的信息。

      例如,在 Debian 上安装它:

      sudo apt-get install php5-intl
      

      之后别忘了重启你的网络服务器。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-07-03
        • 2013-03-16
        • 2019-05-11
        • 1970-01-01
        相关资源
        最近更新 更多