I want to clear the session in a project. If i have opened an another project in the same browser, that session also cleared. How to clear the session without affecting the other projects?
Jump to Post
try using unset()
<?php session_start(); unset($_SESSION['username']); unset($_SESSION['user_id']); or session_start(); unset($_SESSION['username'], $_SESSION['user_id']) ?>
With this you could unset specific vars if needed. or you could
to kill them all.
When I write logout scripts I use
<?php session_start(); session_unset(); session_destroy(); …
All 2 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.