我需要使用 PHP codeigniter 显示数据库中的标记我不会得到地图
function initialize() {
var myLatLng = new google.maps.LatLng(18.5236, 73.8478);
var mapOptions = {
zoom: 14,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
// Add 5 markers to the map at random locations.
var southWest = new google.maps.LatLng(18.5236,73.8478);
var northEast = new google.maps.LatLng(19.5236,75.8478);
var bounds = new google.maps.LatLngBounds(southWest,northEast);
map.fitBounds(bounds);
var lngSpan = northEast.lng() - southWest.lng();
var latSpan = northEast.lat() - southWest.lat();
//If I comment below line it show blank map
beaches = [ <?php foreach($records as $row) echo "[".$row->property_title.', '.$row->property_latitude.', '.$row->property_longitude.'],'?>]"
for (var i = 0; i < beaches.length; i++) {
var beach = beaches[i];
var myLatLng = new google.maps.LatLng(beach[1], beach[2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: beach[0]
});
}
}