foreach ($arrResults['statuses'] as $arrSearchResult)
{
$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json? address='.str_replace(" ","+", urlencode($address)).'&sensor=false');
$output = json_decode($geocode);
if($output->status == 'OK')
{
echo "Latitude : ".$latitude = $output->results[0]->geometry->location->lat;
echo "<br/>";
echo "Longitude : ".$longitude = $output->results[0]->geometry->location->lng;
}
,我的脚本是:
$(document).ready(function ()
{
var latitude = parseFloat ("<?php echo $latitude; ?>");
var longitude = parseFloat ("<?php echo $longitude; ?>");
var latlngPos = new google.maps.LatLng (latitude, longitude);
// Set up options for the Google map
var myOptions = {
zoom: 14,
center: latlngPos,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoomControlOptions: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.LARGE
}
};
// Define the map
map = new google.maps.Map(document.getElementById("map"), myOptions);
// Add the marker
var marker = new google.maps.Marker({
position: latlngPos,
map: map,
title: "Your Location"
});
});
</script>
因为这个脚本只显示经度和纬度的最后一个值,但我想显示所有以前的位置....当我使用echo它显示所有纬度和经度.....请帮助我< / p>