PHP使用标头位置在框架集中重定向

jamesxu-eg

会话无效后,我使用php中的标头位置重定向到登录页面。

代码很简单。

PHP代码:

if($_SESSION['admin_id']){

  header('location:login.php');
}

但是问题发生了,尽管超时了,但我在布局的主框架中刷新了浏览器的login.php负载。

这是我的框架集代码的布局。HTML代码:

>>><frameset rows="135,*" cols="*" frameborder="no" border="0" framespacing="0">

  <frame src="index.php?action_type=top" name="topframe" scrolling="no" noresize="noresize" id="topframe" title="" />
  <!--<fram src ="index.php?action_type=content" name="maiframe" scrolling="no" noresize="noresize" id="mainframe" />-->

  <frameset cols="225,*" frameborder="no" border="0" framespacing="0">

    <frame src="index.php?action_type=menu" name="menuframe" scrolling="no" noresize="noresize" id="menuframe" title="" />

    <frame class="framebordertop" src="index.php?action_type=login-info" name="mainframe" scrolling="auto" noresize="noresize" id="mainframe" title="" />

  </frameset>

</frameset>

<noframes>

</noframes>
完美的
<?php

if( ....... ){ //if session is invalid
    die("<script>
        if(typeof(parent) != 'undefined'){
            parent.window.location.href='login.php';
        }else{
            window.location.href='login.php';
        }
    </script>");
}

?>

试试这个 ?

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章