我使用codeigniter和Google Maps API V3库。一切都在构造函数等中加载......
我的控制器内容来自......
$config['icon'] = "http://localhost/xampp/zadanie_/myimg.png";
$config['center'] = $data['lat'].",".$data['lon'];
$config['map_height'] = 180;
$config['sensor'] = false;
$config['map_width'] = 198;
$config['disableMapTypeControl'] = TRUE;
$config['disableStreetViewControl'] = TRUE;
$config['zoom'] = '10';
$this->googlemaps->initialize($config);
$marker = array();
$marker['position'] = $data['lat'].",".$data['lon'];
$this->googlemaps->add_marker($marker);
之后,加载页面...... 生成的Javascript包含以下代码:
function initialize() {
var myLatlng = new google.maps.LatLng(48.1405,17.0948);
var myOptions = {
zoom: 10,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
mapTypeControl: false,
streetViewControl: false}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var myLatlng = new google.maps.LatLng(48.1405,17.0948);
var markerOptions = {
map: map,
position: myLatlng
};
marker_0 = createMarker(markerOptions);
}
没有图标项。我做得不好? :(
答案 0 :(得分:1)
用$config['icon'];
替换$marker['icon'];
可以解决问题。