2011-11-02 77 views
0

我需要将.php文件的输出添加到iframe中。这可能吗?将php添加到iframe中

if($_GET['someAction']=="somePage"){ 
    require_once("somePage.php"); 
} 

如何将上述代码的输出转储到iframe中?

回答

0

如何将上述代码的输出转储到iframe中?

将它放在元素中,而不是通过require要求它在服务器端。

if($_GET['someAction']=="somePage") { 
    echo '<iframe src="somePage.php"></iframe>'; 
} 
+0

我不是在PHP好。它在iframe中显示“somePage.php”的一些错误。我只需要添加该文件一次。所以我添加了“require_once()”,它对我很有用。现在在iframe中需要它。如果你能理解,请告诉我一些事情 – sura2k

+0

你为什么想在iframe中做这件事?没有更多的上下文无法帮助你。 – meagar

+0

我想加载几页。所以我想使用iframe。 – sura2k

0

你可以直接插入此代码到您的HTML:

<?php if($_GET['someAction']=="somePage"){ ?> 
<iframe src="somePage.php"></iframe> 
<?php } ?>