duanjianl183188 2016-02-17 14:36
浏览 10
已采纳

Google Map嵌入式填充地址字符串

So i have collected addresses in my database in the following format:

address line 1 | address line 2 | post code

How can i pull this in through php to generate an embedded google maps?

Someone like this is what im looking for:

<?php    
    $address = $address_line_1 . $address_line_2 . $postcode
?>


<iframe src="http://www.google.com/maps/embed?<?= $address ?>"></iframe>
  • 写回答

1条回答 默认 最新

  • douya2006 2016-02-17 16:38
    关注

    See the documentation for the "place mode":

    The following URL parameter is required:

    q defines the place to highlight on the map. It accepts a location as either a place name, address, or place ID. The string should be URL-escaped, so an address such as "City Hall, New York, NY" should be converted to City+Hall,New+York,NY. (The Google Maps Embed API supports both + and %20 when escaping spaces.)

    <iframe width="600" height="450" frameborder="0" style="border:0" src="
      https://www.google.com/maps/embed/v1/place
       ?key=YOUR_API_KEY
       &q=Eiffel+Tower,Paris+France
    "></iframe>
    

    example

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?