I was wondering if after starting the session, session_id automatically stores a value? or does session_id will ever have a value if some user successfully logged on the page?
Asked
Active
Viewed 66 times
2 Answers
0
You are correct, once the session is started a session id is created. The browser stores a cookie, PHPSESSID
, that identifies it. Eventually that cookie expires, depending on their browser settings and the lifetime your server gives it. After that the user will no longer be able to access the session.

wogsland
- 9,106
- 19
- 57
- 93
0
Yes, session_id()
is automatically generated when you start the session session_start()
, you can use session_id()
like below:
if (session_id() === "") {
session_start();
}

Kausha Mehta
- 2,828
- 2
- 20
- 31