我有以下代码,从数据库中提取地址。
<td class="center"><?php echo ($customer->address!='')?$customer->address:'NA';?></td>并在行政区域上显示地址。
我希望这个地址被连接到google地图
<a href="maps.google.com/?p= {then the addy} "> {the addy} </a>但是当我将链接添加到代码中时,代码就会中断。
最近的尝试是
<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>发布于 2013-08-03 22:15:54
您的代码很好,应该只需将google地址更改为https://maps.google.com/maps?q=即可。
发布于 2013-08-03 22:07:32
对于一个有效的Google,你所要做的就是转到http://maps.google.com,输入你想要的地址,然后点击‘链接按钮’。你可以去掉一个更短的版本,这个版本仍然有效。例如:纽约曼哈顿第15大道就像https://maps.google.co.uk/maps?q=1+5th+Avenue,Manhattan,New+York,United+States一样。因此,只需在地址的各个部分之间加上',‘,并为每个空格添加'+’。
https://stackoverflow.com/questions/18037714
复制相似问题