您可以在 PHP 4 和 PHP 5 中使用setlocale()
and执行此操作localeconv()
:
$locale = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);
setlocale(LC_MONETARY, $locale);
print_r(localeconv());
样本输出:
Array
(
[decimal_point] => .
[thousands_sep] =>
[int_curr_symbol] => EUR
[currency_symbol] => €
[mon_decimal_point] => ,
[mon_thousands_sep] =>
[positive_sign] =>
[negative_sign] => -
[int_frac_digits] => 2
[frac_digits] => 2
[p_cs_precedes] => 1
[p_sep_by_space] => 1
[n_cs_precedes] => 1
[n_sep_by_space] => 1
[p_sign_posn] => 1
[n_sign_posn] => 2
[grouping] => Array
(
)
[mon_grouping] => Array
(
[0] => 3
[1] => 3
)
)
ISO 4217 代码包含在结果数组的int_curr_symbol
键中。