设置php.ini中:
session.auto_start = 0
session.cookie_lifetime = 0
------------------------------
PHP文件中....
session_start();
session_destroy();
-----------------

解决方案 »

  1.   

    我的php.ini文件中已经这样设置了的
    session.auto_start = 0
    session.cookie_lifetime = 0
    -----------------
    还是不能结束session
      

  2.   

    这样判断的:
    session_start();
    if (!isset($UserName)){?>
    <script language="javascript">
    top.location='/Admin/Public/adminuser.php';
    </script>
    <?}?>
      

  3.   

    session_destory()是将存放在session中的数据清楚,而页面打开时,已经将session中的数据读到页面,所以在此页面输出加入session的变量还是会有结果的。
    举个简单的例子:
    a.php
    <?php
    session_start();
    $_SESSION['test']='abcde';
    session_destroy();
    echo $_SESSION['test'];
    echo '<a href="b.php">to b</a>';
    ?>
    -----
    b.php
    <?php
    session_start();
    echo $_SESSION['test'];
    ?>
    结果一试便知。
      

  4.   

    This function doesn't unset the corresponding global variable for name, it only prevents the variable from being saved as part of the session. You must call unset() to remove the corresponding global variablesession_start();
    session_unregister("UserName");
    unset($_SESSION["UserName");  //<---here Test it!
    session_destroy();
      

  5.   

    只使用session_destroy();就可以清除Session
    不用别的。但必须在第一行写上session_start();是不是你在清除session后又重新注册了它(重定向到了另一个页面)