【问题标题】:How to redirect to a page in an iframe but should load as a different page?如何重定向到 iframe 中的页面但应作为不同页面加载?
【发布时间】:2013-11-21 13:48:54
【问题描述】:

我在一个页面中调用了一个 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 html redirect iframe


    【解决方案1】:

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

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

    此外,您不能按照您尝试的方式嵌套 PHP 标记

    【讨论】:

    • 嵌套php标签是什么意思?
    • @RuchinaPerera php标签里面的php标签,它不起作用,查找连接。
    • 那么如何使链接动态化。例如 id=1 和 id = 2 在另一个选项卡中?我们需要使用 php 对其进行动态化,对吗?
    • 是的,你不能在另一个
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多