세션 쿠키를 삭제하려고합니다. 다음 단계는 내가 따르는 단계입니다.세션 쿠키가 만료되었습니다.
// 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();
이것은 분명히 나를 로그 아웃합니다. 그러나 실제 쿠키는 여전히 존재하며 브라우저 (firefox)에서 볼 수 있습니다.
$_COOKIE[session_name()]
은 세션 이름과 반대되는 암호화 된 콘텐츠 문자열을 반환하는 것으로 보입니다.
질문 :
$ _COOKIE [session_name()] 무엇 인 세션 이름을 얻을 수있는 올바른 방법이없는 경우?
기본값을 허용하는 대신 session_name을 설정해야합니까?
가비지 수집을 기다리고 있으므로 세션이 표시됩니까?
그게 맞다면 참조 너무 확실하지 : http://php.net/manual/en/function.session- destroy.php – hakre
session_id가 실제로 작동하지 않습니다. null을 반환하는 것으로 보입니다. 뿌리 즉 '/'에 대한 신뢰가 쿠키 매개 변수를 가져오고 사용하는 것이 아니라 잘못 되었다면 궁금합니다. – codepuppy
이전에이 설명서를 읽었지만 단어를 적용하지 않았습니다. 나는 방금 시도했지만 도움이되지 않았습니다. – codepuppy