如何重定向到iframe中的页面但应该作为不同的页面加载?

时间:2013-11-09 15:54:44

标签: php html redirect iframe

我在页面中调用了iframe,在iframe中有一个链接,当点击应打开另一个页面时。但是当我在php中使用标题标签时,它会在iframe中加载页面。 我该如何解决这个问题?

第1页: <iframe width="990" height="245" src="example2.php?id=<?php echo $_GET['id'];?>" frameborder="0" scrolling="no" ></iframe>

iframe - example.php?id =:

<?php header ("Location: example3.php?class=<?php echo $_GET['classid']"); ?>

如何在不加载第1页iframe的情况下将此页面重定向到其他页面?

1 个答案:

答案 0 :(得分:4)

你不能只使用PHP,但你可能会做这样的事情,使用javascript:

<?php echo '<script type="text/javascript">window.top.location.href = "example3.php?class=' . $_GET['classid'] . '"; </script>' ?>

此外,您无法以您尝试的方式嵌套PHP标记