session注销怎么写,注销后台用户信息,求代码……(当你点击退出链接)就执行退出

解决方案 »

  1.   

     unset($_SESSION[' ']);
     session_destroy();
      

  2.   


    $_SESSION = array();
    session_destroy();
      

  3.   

    使用unset($_SESSION['key']);key为你的SESSION关键字
      

  4.   

    后台退出按钮
    <a href="logout.php?key=out" target="_top">退出</a>logout.php<?php
      
       if($_GET['key'] == "out"){
          
           unset($_SESSION['这里是你登录时候设置的SESSION']);
           echo "<script>alert('退出成功!');location.href='login.php'";
        } 
    ?>
      

  5.   


    unset($_SESSION["name"]);session_destroy();
      

  6.   

    unset($_SESSION["name"]);session_destroy();
      

  7.   

    session_destroy(); LZ要注意Session注销时机 比如叉掉浏览器
      

  8.   


    session_unset();
    session_destroy();
    header('Location: index.php');
    exit();
      

  9.   

    session_unset(); //free里面的值,所有键值为空
    session_destroy(); //销毁session
    $_SESSION = array(); //把session变量设置为空数组
      

  10.   

    angelitoestebancito at gmail dot com 16-Aug-2008 09:41
    If you create a logout.php to end user session, do not forget to start the session in this page!, using session_start() at the very begging of your script. Thus,session_start();
    session_unset();
    session_destroy();will be the right sequence to end a user's session.
    This is a very basic concept, but took me a while to realize I was forgetting to start the session.from:http://hk.php.net/manual/en/function.session-unset.php