Javascript 使用PHP中的_top重定向
我对PHP和重定向页面有疑问。在我的HTML中,我有一个iframeJavascript 使用PHP中的_top重定向,javascript,php,html,Javascript,Php,Html,我对PHP和重定向页面有疑问。在我的HTML中,我有一个iframe <iframe class="container" name="content" id="content" src="LandingPage.php" name="contents" scrolling="no" frameborder="0" onload="sizeFrame(this)" ></iframe><!-- CONTENT frame --> 我希望将整个文档重新加
<iframe class="container" name="content" id="content" src="LandingPage.php" name="contents" scrolling="no" frameborder="0" onload="sizeFrame(this)" ></iframe><!-- CONTENT frame -->
我希望将整个文档重新加载到index.php,而不仅仅是在iframe中显示index.php。目前,我所有的努力和搜索建议都将index.php文件加载到iframe中。如何强制页面卸载当前loggedin.html文件并在同一窗口中仅重新加载index.php
我在LandingPage.php的顶部测试了以下内容,以确保页面可以显示
不是会话出错,因为index.php文件显示的位置不正确
if(! isset($_SESSION['loginvalid']))
{
//header("Location: index.php");
//exit();
$URL="index.php";
$t = "_top";
echo "<script>window.location.replace='$URL' target= '$t'</script>";
//echo"window.location.href = $URL target= \"_top\"";
exit;
} else {
if(!isset($\u会话['loginvalid']))
{
//标题(“Location:index.php”);
//退出();
$URL=“index.php”;
$t=“_top”;
echo“window.location.replace='$URL'目标='$t';
//echo“window.location.href=$URL target=\”\u top\”;
出口
}否则{
任何帮助和建议都将不胜感激。而不是
<script>window.location.replace='$URL' target= '$t'</script>
window.location.replace='$URL'目标='$t'
试一试
parent.location='$URL'
窗口
在iframe中不是父页面窗口,它只是iframe中的窗口,我明白你的意思。脚本引用了不正确的元素。谢谢!好的。非常感谢!这解决了问题!非常感谢您的帮助。
<script>parent.location='$URL'</script>