2014-01-10 2 views
1

당신은이 작업을 수행 할 수 있습니다 내가 접두사를 설정하는 방법Zend2 : 통화 접두어를 지정 하시겠습니까? Zend2에서

R 120.00 

: 내가 생각 종료 할 그러나

ZAR 120.00 

:에

<?php echo $this->currencyFormat(120, 'ZAR'); ?> 

이됩니다 오히려 통화 기호로, 코드에 apposed? 다음은 작동하지 않습니다 (분명히) :

답변

1

알아 냈어. 쉬운이 같이

다음
$helper->setCurrencyPattern('R #0.#'); 

그래서 제가 한 곳 (Module.php)에서 모든 것을 제어 할 수 있습니다 전체 코드가 될 때 :

class Module 
{ 
    public function getConfig() 
    { 
     return array(
      'view_helpers' => array(
       'factories' => array(
        'currencyFormat' => function($sm) 
        { 
         $helper = new \Zend\I18n\View\Helper\CurrencyFormat; 
         $helper->setCurrencyCode("ZAR"); 
         $helper->setLocale('us_ZA'); 
         $helper->setCurrencyPattern('R #0.#'); 

         return $helper; 
        }, 
       ) 
      ), 
     ); 
    } 
} 

즐기 ...

관련 문제