地址在PHP变量,谷歌地图嵌入没有Javascript?

use*_*076 8 php google-maps geocoding

我认为自己是一个普通的PHP编码器,但我几乎无法编辑我在网站上需要的一些JavaScript代码.我在PHP变量中有一个地址,我希望在我的网页上显示一个简单的地图.我在互联网上做了一些研究,我找到了很多运算地理编码,将地址转换为Google API理解的位置,但我完全迷失了.有没有简单的代码可以嵌入我的变量?

Nap*_*lux 27

您可以使用iframe并将地址作为URL参数传递.

<iframe width="640" height="480" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.it/maps?q=<?php echo $yourAddress; ?>&output=embed"></iframe>
Run Code Online (Sandbox Code Playgroud)

  • 在插入之前尝试urlencode()你的地址数据:) (6认同)