How to tell if a session is active?

后端 未结 7 1412
长发绾君心
长发绾君心 2020-11-27 16:20

Per request, there are a few different ways that you can tell whether or not a session has been started, such as:

$isSessionActive = (session_id() != \"\");
         


        
相关标签:
7条回答
  • 2020-11-27 17:15

    There are multiple places you need to check to verify the session is active:

    1- cookie exists and is not expired 2- underlying session storage mechanism (file system or database) has a record matching the cookie.

    0 讨论(0)
提交回复
热议问题