时间:2021-07-01 10:21:17 帮助过:36人阅读
";// Google HQ $prepAddr = str_replace(' ','+',$address); $geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$prepAddr.'&sensor=false'); $output= json_decode($geocode); $lat = $output->results[0]->geometry->location->lat; $lng = $output->results[0]->geometry->location->lng; ?> 第二步,将获取到的坐标嵌入到地图即可 代码就两段,很简单。
http://www.bkjia.com/PHPjc/746588.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/746588.htmlTechArticle第一步,获取坐标 ?php$address = !empty($_POST['address'])?$_POST['address']:?=$navinfor[字段名称]?;// Google HQ$prepAddr = str_replace(' ','+',$address);$geocode=file_g...