Check If Session Is Started Php

check if session is started php
if (session_status() == PHP_SESSION_NONE) {
session_start();
}
php check if session is running
<?php
if(session_status() == PHP_SESSION_ACTIVE){
//a session is already running
session_destroy(); //stops the session
}
?>
php start session if not started
#you could just ignore warnings messages
@session_start();

Leave a Comment