Google 由地址字符串填充的嵌入地图

Google Map embedded populated by address string

所以我在我的数据库中收集了以下格式的地址:

地址第 1 行 |地址第 2 行 | post代码

我如何通过 php 引入它来生成嵌入的 google 地图?

我正在寻找这样的人:

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


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

参见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