PHP致命错误:类捆绑\\ \\控制器\\的Symfony组件\\ \\国际机场国际找不到

问题描述:

我需要什么样的PHP致命错误:类捆绑\ \控制器\的Symfony组件\ \国际机场国际找不到

  • 我需要国家代码转换为货币符号。

    like for USD => $. 
    
  • 我需要将货币代码转换为货币符号。

代码

控制器

use Symfony\Component\Intl\ResourceBundle\CurrencyBundle; 
class EventDetailController extends Controller 
{ 
      $currency = $data[0]['currency']; 
      $Currency= USD 

     Symfony\Component\Intl\Intl::getCurrencyBundle()->getCurrencySymbol('USD'); 
} 

错误

PHP Fatal error: Class 'Acme\\biztradeshowsBundle\\Controller\\Symfony\\Component\\Intl\\Intl' not found in /home/indiamart/public_html/10into/src/Acme/biztradeshowsBundle/Controller/EventDetailController.php on line 180 

你应该写use声明:

use Symfony\Component\Intl\ResourceBundle\CurrencyBundle; 
use Symfony\Component\Intl\Intl; 

class EventDetailController extends Controller 
{ 
    $currency = $data[0]['currency']; 
    $Currency= USD 

    Intl::getCurrencyBundle()->getCurrencySymbol('USD'); 
} 

或写斜线你FQCN:

use Symfony\Component\Intl\ResourceBundle\CurrencyBundle; 

class EventDetailController extends Controller 
{ 
    $currency = $data[0]['currency']; 
    $Currency= USD 

    \Symfony\Component\Intl\Intl::getCurrencyBundle()->getCurrencySymbol('USD'); 
} 
+0

错误PHP致命错误:类 '资源包' 不是在/ home/indiamart /的public_html/10into /供应商/ symfony中/ symfony中/ src目录/ Symfony的/分量/国际机场发现第31行的/ResourceBundle/Reader/BinaryBundleReader.php – user2818060 2014-10-31 07:13:41

+0

这是另一个问题:-)你可以为此开始新的话题。 但我需要问你:你读过http://symfony.com/doc/current/components/intl.html吗?你的问题在Intl组件中。也许你没有正确安装php-intl扩展。 – 2014-10-31 07:17:57

+0

如何检查php-intln正确安装 – user2818060 2014-10-31 07:31:37