PHP访问用户所在的国家(地区) [英] PHP Accessing the user's country (locale)
本文介绍了PHP访问用户所在的国家(地区)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否存在对用户所在国家/地区的超全局引用,或者是将IP用于针对国家/地区的IP查找数据库的最佳方法?
Is there a superglobal reference to the user's country or is using the IP against a database of IP to Country lookups the best way to go?
推荐答案
我希望在php99中有诸如$_SERVER['HTTP_COUNTRY']
...之类的东西? ;)
暂时 http://php.net/manual/en/book.geoip .php 是您最好的选择
i wish there were such thing as $_SERVER['HTTP_COUNTRY']
... maybe in php99 ? ;)
for the time being, http://php.net/manual/en/book.geoip.php is your best bet
但是,如果您只对用户的语言感兴趣,则有$_SERVER["HTTP_ACCEPT_LANGUAGE"]
however, if you're only interested in user's language, there is $_SERVER["HTTP_ACCEPT_LANGUAGE"]
这篇关于PHP访问用户所在的国家(地区)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文