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条)

报告相同问题?

悬赏问题

  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计