Warning: session_destroy(): Trying to destroy uninitialized session
This error is common when you haven't started the session beforehand
if (!isset($_SESSION))
{
session_start();
}
You have to call the function mentioned below at the top your logout function in the logout class.
session_start();
Add the above function and try it out. If you don’t start the session at the top of your file, it will throw exceptions like “headers already sent”, “can’t start the session”, etc.