PHP Accessing the user's country (locale)
问题 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? 回答1: 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 however, if you're only interested in user's language, there is $_SERVER["HTTP_ACCEPT_LANGUAGE"] 回答2: Here are some more options for ip to country lookups http://www.hostip.info/ http://pear.php