1
我想向用戶展示買入/賣出表格,並且我希望他們的本地貨幣已經被填充,因此非美國客戶在每次訪問該頁面時都不必更改。是否有可能檢測到沒有ICU的PHP最好的本地貨幣?
我被希望看到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) {
}
}
因此,考慮到香草PHP失敗了我,我不能用庫,是這仍然是可能的?
好吧,暫時切換到它,所以我怎麼得到用戶的語言環境? – Supuhstar