Php 谷歌地图&x2B;XAMPP
如何使用XAMPP(作为本地主机)测试GoogleMapsAPI。在这件事上的任何帮助都是非常感谢的。一个适当的教程链接将是非常有帮助的Php 谷歌地图&x2B;XAMPP,php,mysql,html,google-maps,Php,Mysql,Html,Google Maps,如何使用XAMPP(作为本地主机)测试GoogleMapsAPI。在这件事上的任何帮助都是非常感谢的。一个适当的教程链接将是非常有帮助的 提前谢谢 创建一个空白php文件,并将其保存在xampp的htdocs中 粘贴以下代码: <!DOCTYPE html> <html> <head> <title>Simple Map</title> <meta name="viewport" content="initia
提前谢谢 创建一个空白php文件,并将其保存在xampp的htdocs中 粘贴以下代码:
<!DOCTYPE html>
<html>
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
/* Always set the map height explicitly to define the size of the div
* element that contains the map. */
#map {
height: 100%;
}
/* Optional: Makes the sample page fill the window. */
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: -34.397, lng: 150.644},
zoom: 8
});
}
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=**YOUR_API_KEY**&callback=initMap"
async defer></script>
</body>
</html>
简单地图
/*始终明确设置贴图高度以定义div的大小
*包含映射的元素*/
#地图{
身高:100%;
}
/*可选:使示例页面填充窗口*/
html,正文{
身高:100%;
保证金:0;
填充:0;
}
var映射;
函数initMap(){
map=new google.maps.map(document.getElementById('map'){
中心:{纬度:-34.397,液化天然气:150.644},
缩放:8
});
}
将“上面的api密钥”替换为可以从谷歌地图网站获得的api密钥
你准备好出发了