Destroying sessions in PHP

3

I was researching about logout functions in php and I saw examples like:

if(isset($_SESSION)) { 
     unset($_SESSION['minhaSessao']); //repetir para cada sessao
     session_unregister(); 
     session_destroy(); 
}

I wanted to know if there is any way to clear all the active sessions of my application without having to set one by one repeatedly.

    
asked by anonymous 24.03.2015 / 18:32

2 answers

4

This code is redundant, only session_destroy(); alone solves the case. You do not need if , nor other commands.

link

    
24.03.2015 / 18:35
1

create a file with only session_destroy(); and use logoff, it is enough to break all php sessions

    
24.03.2015 / 18:51