如何在PHP中获取当前的语言环境 [英] how to get current locale in PHP
本文介绍了如何在PHP中获取当前的语言环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获取服务器的当前系统区域设置(例如Windows 7 OS).这是为了确保不同的语言设置使用PHP中不同的代码部分.
但是,我找不到执行此操作的任何API.
谁能告诉我函数的名称吗?
I would like to get the current system locale of a server (say windows 7 os). This is to ensure that different language setting uses different parts of code in PHP.
However, I could not find any API that does this.
Can anyone tell me the name of the function?
推荐答案
上面来自Gags的最佳答案. 如果要当前请求中的accept-language:标头的内容,如果有,请使用:
Best answer above from Gags. If you want the contents of the accept-language: header from the current request, if there is one, use:
$_SERVER['HTTP_ACCEPT_LANGUAGE']
这篇关于如何在PHP中获取当前的语言环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文