开发者

Test if session is started

开发者 https://www.devze.com 2023-01-09 13:01 出处:网络
How do you test to see if sessions are on. This is not the way... session_start(); if(isset($_SESSION)开发者_JAVA百科) {

How do you test to see if sessions are on. This is not the way...

session_start();
if(isset($_SESSION)开发者_JAVA百科) {
    echo "sessions ON<br>";
}
else{
    echo "sessions OFF<br>";
}

session_destroy();
if(isset($_SESSION)) {
    echo "sessions ON<br>";
}
else{
    echo "sessions OFF<br>";
}


Try this:

if(session_id())

http://php.net/manual/en/function.session-id.php


session_start() itself will return boolean TRUE if the session was started successfully, boolean FALSE if not.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号