0
Someone knows how to destroy all PHP sessions? Those that are created with
$_SESSION = 'valor_qualquer';
0
Someone knows how to destroy all PHP sessions? Those that are created with
$_SESSION = 'valor_qualquer';
1
session_destroy() destroys all data associated with the current session. It does not delete any of the global variables associated with the current session, nor does it delete the session cookie. To use session variables again, session_start() must be called.
Note: It is not necessary to call session_destroy() in a usual code. Instead of destroying session data, clear the $_SESSION array.
<?php
// Inicializa a sessão.
// Se estiver sendo usado session_name("something"), não esqueça de usá-lo agora!
session_start();
// Apaga todas as variáveis da sessão
$_SESSION = array();
// Se é preciso matar a sessão, então os cookies de sessão também devem ser apagados.
// Nota: Isto destruirá a sessão, e não apenas os dados!
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 42000,
$params["path"], $params["domain"],
$params["secure"], $params["httponly"]
);
}
// Por último, destrói a sessão
session_destroy();
?>
Source: http://php.net/manual/en/function.session-destroy.php
Thanks man! That solves the problem.
is us, anything we are there. @Jackson
Browser other questions tagged php
You are not signed in. Login or sign up in order to post.
Read the function documentation
session_destroy
.– Woss
All sessions of different users or all data of a specific session?
– Guilherme Nascimento