Subscribe To Our Newsletter

Sign Up Now To Get Free Coupon Codes, Event Coupon Codes Updates, Offers Updates. It's 100% Free!

We Hate Spam! Really, It's terrible and we never do it.

PHP | How to destroy session?

PHP Session
On +Wizpert, Someone asked me that how to destroy session?
Session is used for specific purpose. like
  • Login user
  • Review creation
  • Forms Creation
  • Check Out system
  • And more
In this code you will learn, How to destroy session on logout click?


 <?php  
 $_SESSION = array(); // Oh Sorry here you need to null all sessions  
 setcookie(session_name(), '', time()-60); // here you will set cookies time back to age. like time()-60 mean . 1 minute before now.  
 session_destroy(); // here you will delete session  
 header("Location: login.php"); // here you will be reallocated to login.php page.  
 exit; // page code will be exit.  
 ?>  

I hope this can help you.
Share this article :

Post a Comment

Give your reviews about this blog. Leave your comments. what do you think about this post?

Comments Description is given below:
1) I love to read comments, but do not spam.
2) Like this blog and also tweet its posts.
3) You can use some xHTML tags.
4) All Comments are Do Follow, Please try to use blog professionally.
5) Mention Your Name below the comment.
6) You can also suggest for improvement.
7) Do not forget to subscribe Samee Articles blog.

---------------------------------------
Thanks for visiting QWC.Me.
==========================================
For free guidelines contact me on SEO Expert | Samee Ullah Feroz is online there.
==========================================
Best Regards

 
Support : | Internet Marketing Specialist And Business Developer
Copyright © 2013-2016. Samee Articles - All Rights Reserved
Proudly powered by Blogger