Php 过期的会话cookie似乎仍然存在

Php 过期的会话cookie似乎仍然存在,php,session-cookies,Php,Session Cookies,我正在尝试删除会话cookie。这些是我正在遵循的步骤 // Find the session - I believe this is doing a resume rather than starting a fresh session thus identifying the session. session_start(); // Unset all the session variables enmasse by assigning an

我正在尝试删除会话cookie。这些是我正在遵循的步骤

        // Find the session - I believe this is doing a resume rather than starting a fresh session thus identifying the session.
        session_start();

        // Unset all the session variables enmasse by assigning an empty array
        $_SESSION = array();

        // find the session name that has been allocated then destroy the session cookie
        if(isset($_COOKIE[session_name()])){
            setcookie(session_name(),'', time()-42000, '/');
           // set content of found session to null, with a past time, at the root
        }

        // Destroy the session 
        session_destroy();
这肯定会让我退出。但是,实际的cookie仍然存在,可以在浏览器(firefox)中查看

似乎返回的是加密的内容字符串,而不是会话名称

问题:

如果$\u COOKIE[session\u name()]不是获取会话名称的正确方法,那么是什么

我应该设置一个会话名称而不是默认名称吗


我看到该会话是因为它正在等待某种垃圾收集吗?

您可能需要查看此页面:

为了完全终止会话(如注销用户),还必须取消设置会话id。如果使用cookie传播会话id(默认行为),则必须删除会话cookie。setcookie()可用于此目的


基于此,您可能希望使用
session\u id()
而不是
session\u name()

如果不确定这是否正确,请参阅:session\u id不工作,它似乎返回null。我想知道我对root,即“/”的依赖是否有错,而不是获取和使用cookie paramsI之前阅读过此文档,但没有逐字应用它。我刚试过这样做,但没有帮助。
$_COOKIE[session_name()]