>  기사  >  백엔드 개발  >  header("Location:index.php")页面跳转有关问题

header("Location:index.php")页面跳转有关问题

WBOY
WBOY원래의
2016-06-13 13:32:52965검색

header("Location:index.php")页面跳转问题
新手求教!!!急!
if($password == $row["password"])
 {
  $_SESSION["admin"]=1;
  $_SESSION["username"]=$username;
  header("Location:index.php");
  exit;
 }
执行这段代码后页面转为空页面,但重新从链接访问这个页面是它又是已经登录的界面(也就是它已经转到index.php了),这是为毛啊???

------解决方案--------------------
必须将浏览器关闭,重新打开后,session才会更新。标签页中,session实际没有销毁。

加个退出页面:

PHP code

//logout.php
session_start();
session_destroy();
header("Location:index.php");
<br><font color="#e78608">------解决方案--------------------</font><br>index界面没有东西? 你最好将表单页面和处理页面分开写。 <div class="clear">
                 
              
              
        
            </div>
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.