Answer the question
In order to leave comments, you need to log in
CodeIgniter - How to work with sessions correctly?
In the autoload.php file, I set the session class to autoload.
Now I'm trying to get the session ID:
$session_id = $this->session->userdata('session_id');
echo $session_id;
Answer the question
In order to leave comments, you need to log in
The method $this->session->userdata()
returns the data that you saved earlier.
To get the session ID, use either session_id()
, or $this->session->session_id
(it refers to session_id()
).
Personally, I would use it $this->session->session_id
, because it can be adjusted to fit your needs if that.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question