<?php
$getip=getIp();
$ip = str_replace('"', '', $getip);
$weather = curl_init();
curl_setopt($weather,CURLOPT_URL,"http://apis.map.qq.com/ws/location/v1/ip?ip=".$ip."&key=你自己的key".time());
curl_setopt($weather,CURLOPT_RETURNTRANSFER,true);
$data = curl_exec($weather);
curl_close($weather);
$data=json_decode($data,true);//将json格式转化为数组格式,方便使用
function array_merge_rec(&$array) { // 参数是使用引用传递的
// 定义一个新的数组
$new_array = array ();
// 遍历当前数组的所有元素
foreach ( $array as $item ) {
if (is_array ( $item )) {
// 如果当前数组元素还是数组的话,就递归调用方法进行合并
array_merge_rec ( $item );
// 将得到的一维数组和当前新数组合并
$new_array = array_merge ( $new_array, $item );
根据无线网络定位
最新推荐文章于 2021-03-25 23:38:50 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)