小数逗号而不是小数点 [英] Decimal comma instead of decimal point
问题描述
如何在Windows上运行的本地服务器上的php.ini中在代码中未进行任何更改的方式将小数点更改为十进制逗号?
How can I change a decimal point to decimal comma by setting it in php.ini without any changes in code on my local server running on Windows?
3.14 >> 3,14
我尝试设置
intl.default_locale = cs_CZ
没有任何结果.
编辑:我问的原因是,如果我在托管服务器上执行代码,我会得到带小数点逗号的数字,但是当我将相同的代码传输到本地服务器时,会有一个小数点.渔获物在哪里?
EDIT: The reason why I'm asking is that if I execute the code on hosting I get numbers with decimal comma, but when I transfer same code to my local server there is a decimal point. Where is the catch?
例如-Linux托管:
For example - Linux hosting:
echo 100 / 3; // 33,333333333333
Windows上的本地服务器:
Local server on Windows:
echo 100 / 3; // 33.333333333333
原因是什么?
编辑2 :如果我使用
setlocale(LC_NUMERIC, 'cs_CZ');
echo 100 / 3;
我将得到相同的结果 33.333333333333 ,因此捕获必须在配置文件中或Windows本身中.
I will get the same result 33.333333333333, so the catch must be in configuration files or in Windows itself.
推荐答案
所以我发现的唯一方法是,如何在 Windows 上做到这一点:
So what I discovered is that only way, how you can do this on Windows is:
setlocale(LC_ALL, 'czech');
感谢 http://msdn. microsoft.com/en-us/library/39cwe7zf%28v=vs.90%29.aspx
这篇关于小数逗号而不是小数点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!