If i've $_SESSION["something"]
and $_SESSION["else"]
by using session_destroy()
it will destroy both.
but what if i want only to destroy exact session which is $_SESSION["something"]
and keeps $_SESSION["else"]
active.
You can unset($_SESSION['something'])
.
Bear in mind that these aren't separate sessions, they're entries in the same session id. You only have one active session.
$ _SESSION就像一个普通数组.....所以使用unset清除您想要的任何东西...如上一个答案中所建议.....
unset( $_SESSION['variable'] );
The above will not work with register_globals turned on (will only work outside of a function).
$variable = $_SESSION['variable']; unset( $_SESSION['variable'], $variable );
The above will work with register_globals on & inside a function
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.