ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
//地址获取和定位 $getIp = gipetRemoteIPAddress(); $content = file_get_contents("http://api.map.baidu.com/location/ip?ak=enYCQ2yaIIjL8IZfYdA1gi6hK2eqqI2T&ip={$getIp}&coor=bd09ll"); $json = json_decode($content, true); $latitude_longitude=$json['content']['point']['y'].",".$json['content']['point']['x']; $address = file_get_contents("http://api.map.baidu.com/geocoder/v2/?ak=enYCQ2yaIIjL8IZfYdA1gi6hK2eqqI2T&location={$latitude_longitude}&output=json&pois=0"); $arr= json_decode($address, true); echo "你当前的位置:".$arr['result']['formatted_address'].$arr['result']['sematic_description']."<br>"; echo "你当前IP:".$getIp;