谷歌地图不工作在php


Google Map does not work in php

我想显示我的大学地图但它加载了1秒,然后告诉

MissingKeyMapError

对不起!出了什么问题。这个页面无法正确加载谷歌地图。

我使用Google Maps JavaScript API和Web浏览器(JavaScript)。这是我的代码
    <script src='https://maps.googleapis.com/maps/api/js?key=AIzaSyDNi7fQreXQ_AvjDEbMBGtBo2XoP5QkxRs'></script>
    <div style='overflow:hidden;height:440px;width:700px;'>
        <div id='gmap_canvas' style='height:440px;width:700px;'></div>
        <style>#gmap_canvas img {
            max-width: none !important;
            background: none !important
        }       </style>
    </div>
    <script type='text/javascript'>
        function init_map() {
            var myOptions = {
                zoom: 14,
                center: new google.maps.LatLng(22.3475365, 91.81233240000006),
                mapTypeId: google.maps.MapTypeId.ROADMAP
                };
            map = new google.maps.Map(document.getElementById('gmap_canvas'), myOptions);
            marker = new google.maps.Marker({
                map: map,
                position: new google.maps.LatLng(22.3475365, 91.81233240000006)
            });
            infowindow = new google.maps.InfoWindow({content: '<strong>University of Chittagong</strong><br>Chittagong , Bangladesh<br>'});
            google.maps.event.addListener(marker, 'click', function () {
                infowindow.open(map, marker);
            });
            infowindow.open(map, marker);
        }
            google.maps.event.addDomListener(window, 'load', init_map);
    </script>
</head>

这是我的完整代码。

你从哪弄来的钥匙?就像毗湿奴说的,这才是问题所在。如果您没有从Google Maps API文档中获得它,您应该去那里获得一个新的(它们是免费的)。此外,在我看来,你的问题的标题似乎具有误导性,因为你似乎不使用PHP。