本文介绍了PHP setlocale没有任何效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
setlocale()
函数不设置所需的语言(德语)。
The setlocale()
function doesn't set the desired language (german).
目标是输出月份名称。
这是我迄今为止试用的测试代码:
This is my test code with trials so far:
<?php
date_default_timezone_set('Europe/Berlin');
setlocale(LC_ALL, 'de_DE.utf8');
// Or
setlocale(LC_ALL, 'de_DE@euro');
// Or
setlocale(LC_ALL, 'de_DE');
// Or
setlocale(LC_ALL, 'de');
// Or
setlocale(LC_ALL, 'ge');
echo strftime('%B');
输出:
而不是
任何建议?
- 我没有ssh或其他shell访问。
- 脚本在linux服务器上运行。
推荐答案
很有可能在运行脚本的服务器上没有安装德语区域设置 - 你是否有shell访问服务器?
然后尝试
Is is quite likely that the German locale is not installed on the server your running the script on - do you have shell access to the server?Then try
locale -a
查看安装的区域设置。还可以看看这里
to see which locales are installed. Also have a look here Is it feasible to rely on setlocale, and rely on locales being installed?
这篇关于PHP setlocale没有任何效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!