【发布时间】:2013-10-15 02:40:47
【问题描述】:
我想向用户显示一个买/卖表格,并且我希望他们的本地货币已经填写好,这样非美国客户就不必在每次访问该页面时都进行更改。
看到How to get the default currency from the PHP Intl ( ICU library ) 让我充满希望,但问题是我只能使用普通 PHP(我无法控制服务器上安装的内容),所以不要有 ICU 可供我使用。
相反,我查看了重复项并尝试了var_dump(localeconv());,但这导致了这个无用的数组:
array(18) {
["decimal_point"]=>
string(1) "."
["thousands_sep"]=>
string(0) ""
["int_curr_symbol"]=>
string(0) ""
["currency_symbol"]=>
string(0) ""
["mon_decimal_point"]=>
string(0) ""
["mon_thousands_sep"]=>
string(0) ""
["positive_sign"]=>
string(0) ""
["negative_sign"]=>
string(0) ""
["int_frac_digits"]=>
int(127)
["frac_digits"]=>
int(127)
["p_cs_precedes"]=>
int(127)
["p_sep_by_space"]=>
int(127)
["n_cs_precedes"]=>
int(127)
["n_sep_by_space"]=>
int(127)
["p_sign_posn"]=>
int(127)
["n_sign_posn"]=>
int(127)
["grouping"]=>
array(0) {
}
["mon_grouping"]=>
array(0) {
}
}
所以,鉴于 vanilla PHP 失败了,我无法使用库,这还有可能吗?
【问题讨论】:
标签: php internationalization currency