PHP에서 세션 ID가 세션간에 지속되는 이유는 무엇입니까?
다음 코드를 고려하십시오.<?php
if (!session_id())
session_start();
echo session_id();
session_destroy();
?>
이 페이지를 새로 고칠 때마다 어떻게 세션이 파괴되고 매번 다시 작성 되더라도 동일한 세션 ID를 표시합니까? 세션 파괴시 세션 ID가 지워지지 않았습니까?
EDIT :
좋아하는 답변을 기반으로이 업데이트 된 코드를 사용했지만 세션 ID는 아직 유출되지 않습니다! 어떤 아이디어?
if (!session_id())
session_start();
echo session_id();
// Unset all of the session variables.
$_SESSION = array();
// If it's desired to kill the session, also delete the session cookie.
// Note: This will destroy the session, and not just the session data!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
// Finally, destroy the session.
session_destroy();
+1 나를 똑같은 대답으로 때렸다. –
@hakre thanks :) – teemitzitrone
@ maggie- 나는 이것을 시도했지만 작동하지 않았다. 위의 나의 질문 편집을 참조해라. – Yarin