In previous php versions, to determine whether the session is valid, you can only use the following method:
Java code
session_start();
if(isset($_SESSION))
{
echo "Started";
}
else
{
echo "Not Started";
}
In php 5.4 (forthcoming), the status of the session is To subdivide, you can use the following Method judgment:
Java code
session_start();
$status = session_status();
if($status == PHP_SESSION_DISABLED)
{
echo "Session is Disabled";
}
else if($status == PHP_SESSION_NONE)
{
echo "Session Enabled but No Session values Created";
}
else
{
echo "Session Enabled and Session values Created" ;
}
You can see that by using session_status(), an int type value is returned, indicating various statuses of the session, such as prohibited (PHP_SESSION_DISABLED), session does not exist yet
(PHP_SESSION_NONE), Or the session has been established (PHP_SESSION_ACTIVE)