dongzha5934 2014-07-01 15:37
浏览 28

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

So, localeconv() seems to be ignoring the locale in my php script, and returns a basically empty array.

I've found numerous questions, etc. the answers to which all boiled down to the locale not being set correctly for Windows.

I believe this script is setting it using a valid value, and I can confirm the current locale is the one I want to use, but regardless of what the current locale is, localeconv() just returns the same (mostly) empty array.

What I'm looking to see is the mon_decimal_point and mon_thousands_separator values being populated with something.

So, my question is:

What do I have to do to get real results from localeconv()?

Sample script:

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

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

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

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

Script output:

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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
    • ¥15 Python3.5 相关代码写作
    • ¥20 测距传感器数据手册i2c
    • ¥15 RPA正常跑,cmd输入cookies跑不出来
    • ¥15 求帮我调试一下freefem代码
    • ¥15 matlab代码解决,怎么运行
    • ¥15 R语言Rstudio突然无法启动
    • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
    • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
    • ¥15 用windows做服务的同志有吗