根据IP获取位置信息,这里利用了淘宝API,速度比本地查询慢不了多少 无 /** * IP 地址定位 * @param string|integer $ip IP地址 * @param bool $number 是否数字(因此上一个参数为 ip2long 函数转换之后的长整型) * @return array 地址数据 * @throws Excep
根据IP获取位置信息,这里利用了淘宝API,速度比本地查询慢不了多少
/** * IP 地址定位 * @param string|integer $ip IP地址 * @param bool $number 是否数字(因此上一个参数为 ip2long 函数转换之后的长整型) * @return array 地址数据 * @throws Exception 获取出错 */ function location($ip, $number = false) { //如果是数字形式的IP地址,则转换成标准IP if ($number) { $ip = long2ip($ip); } $api = 'http://ip.taobao.com/service/getIpInfo.php'; $resp = file_get_contents($api.'?ip='.$ip); $resp = json_decode($resp,1); if($resp['code'] == 0){ return $resp['data']; }else{ throw new Exception($resp['data']); } }
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号