我使用多台服务器来获取数据,但是当我连接到特定的服务器时,PHP 丢失了语言环境配置。
所以我提取数据并格式化货币号码,但在进程的过程中,如果它连接到该服务器,那么该过程的其余部分不再格式化货币号码...... money_format()命令
localeconv();
前
Array
(
[decimal_point] => .
[thousands_sep] =>
[int_curr_symbol] => USD
[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] => 0
[n_cs_precedes] => 1
[n_sep_by_space] => 0
[p_sign_posn] => 1
[n_sign_posn] => 1
[grouping] => Array
(
)
[mon_grouping] => Array
(
[0] => 3
[1] => 3
)
)
后
Array
(
[decimal_point] => .
[thousands_sep] =>
[int_curr_symbol] =>
[currency_symbol] =>
[mon_decimal_point] =>
[mon_thousands_sep] =>
[positive_sign] =>
[negative_sign] =>
[int_frac_digits] => 127
[frac_digits] => 127
[p_cs_precedes] => 127
[p_sep_by_space] => 127
[n_cs_precedes] => 127
[n_sep_by_space] => 127
[p_sign_posn] => 127
[n_sign_posn] => 127
[grouping] => Array
(
)
[mon_grouping] => Array
(
)
)
这是我运行的脚本:
<?PHP
//set locale information
setlocale( LC_MONETARY,'en_US' );
//print location information
print_r(localeconv());
// Array
// (
// [decimal_point] => .
// [thousands_sep] =>
// [int_curr_symbol] => USD
// [currency_symbol] => $
// [mon_decimal_point] => .
// [mon_thousands_sep] => ,
// ...
// )
//************************************************
//create conenction to server
$connection= new PDO("odbc:server", 'username', 'password');
//************************************************
//see locale information after creating a connection
print_r(localeconv());
// Array
// (
// [decimal_point] => .
// [thousands_sep] =>
// [int_curr_symbol] =>
// [currency_symbol] =>
// [mon_decimal_point] =>
// [mon_thousands_sep] =>
// ...
//
// )
?>
怎么会这样????谢谢