By 12/02/2016 1 Comments

How To Destroy Session Cookie In PHP

  • When you destroy session using session_destroy() function at that time your session is destroyed but that session cookie remains in browser it does not deleted. Following example is used to delete that session cookie from your web browser with the help of session_get_cookie_params() function.

Example:

 session_start();
 // following function assigns last session cookie paramaters array to a variable.
 $session_cookie_param = session_get_cookie_params();
	setcookie(session_name(),"", time() - 3500,
	$session_cookie_param['path'], 
	$session_cookie_param['domain'], 
	$session_cookie_param['secure'], 
	$session_cookie_param['httponly']);
	
	// destroy session and its all data.
	session_unset();
    session_destroy();  
	
	echo "Session cookie has been deleted from your web browser.";






Posted in: PHP, Solutions

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .