If a session is already started or if you want to check if a session have started or is active/valid then you can check in the following way.
session_start();
$session_id = session_id();
if($session_id){
echo "Session is Vaild and ID is: ".$session_id;
}
else{
echo "No Session have started";
}
session_start();
$session_id = session_id();
if($session_id){
echo "Session is Vaild and ID is: ".$session_id;
}
else{
echo "No Session have started";
}
No comments:
Post a Comment