dongmou3615 2014-03-24 08:30
浏览 29
已采纳

PHP 5.5 setlocale()在Windows上无法在CLI中运行?

I'm diagnosing some user problems with German locales. Running

php -r "setlocale(LC_ALL, array('de_DE','deu_deu)); echo 10.01;"

gives

10.01

Running

<?php
echo(setlocale(LC_ALL,array('de_DE','deu_deu')));
echo 10.01;

via WAMP stack gives

German_Germany.1252 10,01

This shows that locale is active and the decimal_point has changed.

Is it a known restricting that setlocale doesn't work in CLI?

  • 写回答

1条回答 默认 最新

  • doujie9252 2014-03-27 10:16
    关注

    After opening an issue with PHP it turns indeed out to be a bug: https://bugs.php.net/bug.php?id=65230

    Funny (or rather not) is that obviously broken behavior won't get fixed or even documented:

    And after all, locale has such issues on any platform. The solution is to use intl or custom localization functionality.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭