drkj41932 2013-11-29 00:24
浏览 298
已采纳

在iframe html标签中使用php

I am trying to create a website that displays another website in an iframe.

This is my code:

<html> 
<title>HTML with PHP</title>
<style>
body {
margin: 0px;
}
</style>
<body>
<?php
$page = $_GET['query'];
echo $page;
?>
<iframe align="center" width="100%" height="100%" src="<?=$page;?>" frameborder="yes" scrolling="yes" name="myIframe" id="myIframe"> </iframe>
</body>
</html>

When I open the php file off of my website (using a url website.com/file.php?query=https://www.google.com, and look in the inspector, I can see the page that the iframe loaded, but it just shows up as a blank page, not the . I have it up at http://www.test.fire-light.tk/web.php?query=url (replace url with any valid url). I am not sure why it shows the blank page.

  • 写回答

3条回答 默认 最新

  • dongying7847 2014-04-03 18:21
    关注

    I think this:

    <iframe align="center" width="100%" height="100%" src="<?=$page;?>" 
      frameborder="yes" scrolling="yes" name="myIframe" id="myIframe"> </iframe>
    

    should be changed into:

    <iframe align="center" width="100%" height="100%" src="<? echo $page; ?>"  
      frameborder="yes" scrolling="yes" name="myIframe" id="myIframe"> </iframe>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码