I am using the following code to cancel a session. I am associated with logout.php on many pages. If you click this link to log out, the logout.php page is logout.php . Below is the code in logout.php .
unset($_SESSION['admin']); session_destroy(); header('Location: index.php');
Once the session is invalid, I want to open the index.php page. But I get the following error:
Warning: session_destroy () [function.session-destroy]: attempt to destroy an uninitialized session in C: \ xampp \ htdocs \ Selection \ logout.php on line 3
Warning: unable to change header information - headers already sent (the output is running in C: \ xampp \ htdocs \ Selection \ logout.php: 3) in C: \ xampp \ htdocs \ Selection \ logout.php on line 4
What's wrong?
php session
user156073
source share