javascript 谷歌地图 V3 API 密钥使用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20179316/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 17:57:04  来源:igfitidea点击:

Google maps V3 API key usage

javascriptgoogle-mapsgoogle-maps-api-3api-key

提问by user1097772

Sounds stupid, but since there is no specific example in documentation, its not clear how to use the api key.
This part of code from documentationis not clear:

听起来很蠢,但是由于文档中没有具体示例,因此不清楚如何使用 api 密钥。文档中的
这部分代码不清楚:

<script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key={API_KEY}&sensor=SET_TO_TRUE_OR_FALSE">
    </script>

Well I will find my apikey, let's say that the value of my api key will be for example: 123456ABCDEFG

好吧,我会找到我的 apikey,假设我的 api 密钥的值将是例如:123456ABCDEFG

So how should I used it?

那我应该怎么用呢?

1)src="https://maps.googleapis.com/maps/api/js?key={123456ABCDEFG}&sensor=false"
or
2)src="https://maps.googleapis.com/maps/api/js?key=123456ABCDEFG&sensor=false"
or else?

1)src="https://maps.googleapis.com/maps/api/js?key={123456ABCDEFG}&sensor=false"

2)src="https://maps.googleapis.com/maps/api/js?key=123456ABCDEFG&sensor=false"
或其他?

回答by Andy

Don't forget the equals.

不要忘记equals.

src="https://maps.googleapis.com/maps/api/js?key=123456ABCDEFG&sensor=false"