繁体   English   中英

PHP致命错误:找不到类Bundle \\\\ Controller \\\\ Symfony \\\\ Component \\\\ Intl \\\\ Intl

[英]PHP Fatal error: Class Bundle\\Controller\\Symfony\\Component\\Intl\\Intl not found

我需要的

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

      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'); 
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM