이것은 간단한 문제 일 수 있지만 도움을 주시면 감사하겠습니다.
MVC 모델에서 위도와 경도 포인트의 다차원 영역 인 $ _SESSION 변수를로드했습니다. 내가
for($i=0; $i<count($markets['results']); $i++) {
.
.
$marketinfo["lat"][$i] = floatval($lat);
$marketinfo["long"][$i] = floatval($lon);
};
$_SESSION['MARKETLOCATION']['LAT'] = $marketinfo["lat"];
$_SESSION['MARKETLOCATION']['LONG'] = $marketinfo["long"];
에서이로드 그 다음에 다음보기 섹션에서이 코드와 헤더에 대한 _template를 호출하고 아래로
<script type="text/javascript">
function createmap(LatLong) {
var firstpass = true;
for (var i = 0; i < $LatLong.length; i++) {
var lat = $LatLong['LAT'][i];
var lng = $LatLong['LONG'][i];
if (firstpass === true){
var map = new google.maps.Map(document.getElementById('map-canvas'),{
zoom: 10,
center: new google.maps.LatLng($lat[0]+','+$lng[0]),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
firstpass = false;
}
var infowindow = new google.maps.InfoWindow();
marker = new google.maps.Marker({
position: new google.maps.LatLng($lat[i]+','+$lng[i]),
map: map
});
}
window.onload=function(){("createmap($_SESSION['MARKETLOCATION']");};
}
</script>
</head>
<body>
<div class='Mapbox' id = 'map-canvas' ></div>
문제는 전혀 표시되지 않는지도입니다. 이 코드를 작성하기 전에 테스트했기 때문에 API 키가 정확하다는 것을 알고 있습니다. 그래서 나는 probibaly 변수 다시 어떤 통찰력을 감상 할 수있다
:
당신은 뭔가를해야한다. – wildandjam