note 119841 deleted from function.session-destroy by peehaa
| From: | peehaa@php.net | Date: | Sun, 28 Apr 2019 10:30:30 +0000 |
| Subject: | note 119841 deleted from function.session-destroy by peehaa | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-210792@lists.php.net to get a copy of this message | ||
Note Submitter: Gaurav
----
For session_destroy() only destroy current session mean that if you specify name or change the save
path of session etc ,it will not destroy it mean for example
create.php
<?php
session_name('testing') ;
session_start() ;
$_SESSION['id'] = '35' ;
?>
delete.php
<?php
session_start() ;
session_destroy() ;
?>
session_destroy only delete the new session which is created by session_start(). correct way is
<?php
session_name('testing') ;
session_start() ;
session_destroy() ;
?>
this is also valid for if you change session.save path throught ini_set() , you have to mention in
delete.php.
remember session_destroy() function destroy only current session not all .i hope this is worth to
mention.