How to get user language by ip address using php?
问题 I need to get language of a user who have visiting my website by their IP address using PHP. how can I do it, there is any API to do this, please advise 回答1: Use the GeoIP module as has previously been suggested and then insert this code somewhere in your project: if($country = geoip_country_code_by_name($host)) { switch($country) { case "DJ": case "ER": case "ET": $lang = "aa"; break; case "AE": case "BH": case "DZ": case "EG": case "IQ": case "JO": case "KW": case "LB": case "LY": case "MA"