更新时间:2023-10-04 13:04:34
如果您有货币代码列表,您可以通过它们并调用:
If you have list of currency codes you can just go through them and call:
public function getCurrenciesAction()
{
$currencies = array('EUR', 'USD'); //here you need to retrieve your currencies list
$symbols = array();
foreach ($currencies as $currency) {
$symbols[$currency] = $symbol = Intl::getCurrencyBundle()->getCurrencySymbol($currency);
}
return new JsonResponse($symbols);
}
然后您可以从整个列表生成 JSON 数组,并通过 AJAX 请求在 JavaScript 中检索它.
You can then generate JSON array from the whole list and retrieve it in JavaScript via AJAX request.