google地图API服务器拒绝了您的请求。请求中指定的‘sensor'参数必须设置为‘true'或'fase'
这是什么情况,我该怎么解决 .在本地调试行,但是运行在服务器上就提示上面那个。
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var directionDisplay; var directionsService = new google.maps.DirectionsService(); var map; var geocoder; function initialize() { directionsDisplay = new google.maps.DirectionsRenderer(); geocoder = new google.maps.Geocoder(); var chicago = new google.maps.LatLng(41.850033, -87.6500523); var myOptions = { zoom: 7, mapTypeId: google.maps.MapTypeId.ROADMAP, disableDefaultUI: true, center: chicago } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); directionsDisplay.setMap(map); directionsDisplay.setPanel(document.getElementById("directionsPanel")); var tmpArr, QueryString; var URL = document.location.toString(); if (URL.lastIndexOf("?") != -1) { QueryString = URL.substring(URL.lastIndexOf("?") + 1, URL.length); QueryString = QueryString.substring(QueryString.lastIndexOf("=") + 1, QueryString.length); tmpArr = QueryString.split("&"); for (i = 0; i < tmpArr.length; i++) { try { var ID = eval(tmpArr[i]); } catch (e) { var re = new RegExp("(.*)=(.*)", "ig"); re.exec(tmpArr[i]); try { eval(RegExp.$1 + "=" + "\"" + RegExp.$2 + "\""); } catch (e) { } } } } else { QueryString = ""; } if (QueryString.length > 0) { document.getElementById("addressIfnfo").value = QueryString; $(document).ready(function() { codeAddress(); }); } } function calcRoute() { var start = document.getElementById("fromAddress").value; var end = document.getElementById("toAddress").value; var request = { origin: start, destination: end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { directionsDisplay.setDirections(response); } }); } function codeAddress() { var address = document.getElementById("addressIfnfo").value; if (geocoder) { geocoder.geocode({ 'address': address }, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); } }); } } </script>
一个密钥对应一台机器。。。换机器了之后要重新申请。。