2011-10-30 08:34
浏览 38

在Ubuntu 11.10上使用PHP的谷歌地图遇到问题

I have a little PHP application in which I am attempting to display Google maps from within the code as a hyperlink. Like so:-

$display_block .= "<td><a href=\"http://maps.google.co.uk/maps?f=q&hl=en&geocode=&q=".$postcode."\">Map</a></td>";

The page is duly assembled and displayed, and hovering with the mouse pointer over the link shows...

http://maps.google.co.uk/maps?f=q&hl=en&geocode=&q=NG34 9JW

Clicking this link gives a blank. All this is done inside a frameset, in case that's important. Typing the reference directly into the browser leads to a map, as expected. This has previously worked, although I haven't checked it for a while. It appears to have stopped working when I upgraded to Ubuntu 11.10 (or possibly an update shortly before that) (the browser is Mozilla Firefox 7.0.1).

I suspect some configuration was trampled on during the update but I've no idea where to start looking. Can anyone offer any suggestions or advice?

图片转代码服务由CSDN问答提供 功能建议

我有一个小的PHP应用程序,我试图在代码中显示谷歌地图作为超链接。 像这样: -

  $ display_block。=“&lt; td&gt;&lt; a href = \”http://maps.google.co.uk/maps?f=  q&安培; HL = EN&安培;地址解析=安培; q = “$邮政编码。 ”\“ &GT;地图; LT; / A&GT;&LT; / TD&gt;” 中; 


  http://maps.google.co.uk/maps?  f = q&amp; hl = en&amp; geocode =&amp; q = NG34 9JW 

单击此链接会显示空白。 所有这些都是在框架集内完成的,以防这一点很重要。 直接在浏览器中输入引用会导致映射,如预期的那样。 这已经有用了,虽然我有一段时间没有检查过。 当我升级到Ubuntu 11.10(或者可能是之前不久的更新)时,它似乎停止了工作(浏览器是Mozilla Firefox 7.0.1)。

我怀疑某些配置被踩踏了 在更新期间,但我不知道从哪里开始寻找。 任何人都可以提供任何建议或建议吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doujiao6507
    doujiao6507 2011-10-30 10:16

    try with target atribbute for example:

    <a href="..." target="_blank">

    and use urlencode() to make proper url



    $display_block .= "<td><a href=\"http://maps.google.co.uk/maps?f=q&hl=en&geocode=&q=".urlencode($postcode)."\" target=\"_blank\">Map</a></td>";
    点赞 评论