1 /** 2 ?* 根据用户IP获取用户地理位置 3 ?* $ip ?用户ip 4 ?*/ 5 function get_position($ip){ 6 ????if(empty($ip)){ 7 ????????return ?‘缺少用户ip‘; 8 ????} 9 ????$url = ‘http://ip.taobao.com/service/getIpInfo.php?ip=‘.$ip;10 ????$ipContent = file_get_contents($url);11 ????$ipContent = json_decode($ipContent,true); 12 ????return $ipContent;13 }
PHP 根据IP获取地理位置
原文地址:https://www.cnblogs.com/ldj3/p/9042305.html