我有以下代码从数据库中提取地址。如何将地址转换为Google Maps链接
<td class="center"><?php echo ($customer->address!='')?$customer->address:'NA';?></td>
并在管理区域显示地址。
我想链接的地址使用
<a href="maps.google.com/?p= {then the addy} "> {the addy} </a>
到Google地图,但在我的链接添加到代码的代码中断。
最新的尝试是
<td class="center"><a href="http://map.google.com/?p=<?php echo ($customer->address!='')?$customer->address:'NA';?>"><?php echo ($customer->address!='')?$customer->address:'NA';?></a></td>
什么实际地址是什么样子? – putvande
1292 Sherwood Mills Boulevard,Mississauga,ON,Canada – user2649441
这将是https://maps.google.co.uk/maps?q=1292+Sherwood+Mills+Boulevard,+Mississauga,+ON,+Canada。正如我在下面的回答中所说的,将所有空格替换为'+'。 – putvande