>我在页面中调用了一个 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 中加载?
你不能只使用 PHP,但你可以使用 javascript 做这样的事情:
<?php echo '<script type="text/javascript">window.top.location.href = "example3.php?class=' . $_GET['classid'] . '"; </script>' ?>
此外,您不能按照您尝试的方式嵌套 PHP 标签