How to destroy PHP session()


To destroy session in PHP you must use session_destroy()

Syntax : bool session_destroy (void)

This method will destroy all the data related to the current session. Note that this will not unset any global variables or session cookies that are associated with the session.

<?php

//Session set
session_start();


$prog="PHP";
$name="Code2care";


$_SESSION['prog'] =  $prog;
$_SESSION['name'] =  $name;


//Destory session
session_destroy();

?>

Note: To kill the session completely, the session id must also be unset.






      Topics: Pages | 2015 | Tutorials | Questions | Python