为什么PHP localeconv()在Windows 7上返回一个空数组?

时间:2014-07-01 15:37:19

标签: php windows locale intl

所以,localeconv()似乎忽略了我的php脚本中的语言环境,并返回一个基本为空的数组。

我发现了很多问题等等,所有问题都归结为没有为Windows正确设置的语言环境。

我相信这个脚本使用有效值设置它,我可以确认当前的语言环境是我想要使用的语言环境,但无论当前的语言环境是什么,localeconv()只返回相同的(大多数)为空阵列。

我期待看到的是mon_decimal_point和mon_thousands_separator值填充了什么。

所以,我的问题是:

我需要做些什么才能从localeconv()中获得真实的结果?

示例脚本:

<?php
echo locale_get_default()."\n";
echo setlocale(LC_MONETARY, locale_get_default()) . "\n";
echo setlocale(LC_MONETARY, '0')."\n";

$locale_info = localeconv();
print_r($locale_info);

echo setlocale(LC_MONETARY, null) ."\n";
echo setlocale(LC_MONETARY, '0')."\n";

$locale_info = localeconv();
print_r($locale_info);

脚本输出:

sve
Swedish_Sweden.1252
Swedish_Sweden.1252
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
        (
        )

)
English_United States.1252
English_United States.1252
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
        (
        )

)

0 个答案:

没有答案