How can you check if a PHP session exists?

前端 未结 11 1315
孤独总比滥情好
孤独总比滥情好 2021-02-04 06:11

Just wondering how to check if a PHP session exists... My understanding is that no matter what, if I am using sessions, I have to start my files with session_start() to even acc

11条回答
  •  伪装坚强ぢ
    2021-02-04 06:55

    I find it best many times (depends on the nature of the application) to simply test to see if a session cookie is set in the client:

    
    

    Of course, replace the default session name "PHPSESSID" with any custom one you are using.

提交回复
热议问题