我需要什么
-
我需要将国家代码转换为货币符号。
like for USD => $.
-
i需要将货币代码转换为货币符号。
代码
控制器
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');
}