我尝试过像这样调用iframe,但它没有用!为什么会这样?
<iframe id="frame" src="load.php?sinput="<?php echo $_GET["sinput"]; ?> > </iframe>
答案 0 :(得分:3)
$_GET['sinput']
需要在src
参数的双引号内:
<iframe id="frame" src="load.php?sinput=<?php echo $_GET['sinput'] ?>">
</iframe>
答案 1 :(得分:1)
简单地说 - 为什么不能这样:) PHP代码的输出进入HTML标记,导致?sinput =仅仅遵循$ _GET ['sinput']在PHP中的含义。但是,没有参数清理这样做是一个非常坏主意,因为假设的攻击者基本上可以输入任意HTML - 和JavaScript! - 在您的页面中使用专门制作的链接。 (有关详细信息,请参阅Wikipedia article on cross-site scripting。)
无论如何,你说它不起作用 - 页面有什么呢?字面上
<iframe src="load.php?sinput=<?php echo $_GET['sinput']; ?>">
或
<iframe src="load.php?sinput=">
?如果它是第一个,那么您的Web服务器没有正确识别该页面包含PHP代码,如果第二个,您的PHP脚本在$ _GET ['sinput']变量中找不到任何内容。