I am trying to get the session id using session_id (); But I find out that it will be regenerated every 5 minutes.
So, I got a trick to set a random number to a user session variable. eg,
$uniqueId = uniqid(rand(), TRUE);
$this->session->set_userdata("my_session_id", md5($uniqueId));
Now the question is where should I put this code. If I put this code in my controller constructor, it will be executed for each request. and will give me a different session id for each request.
How to set this session variable only once? and it will not change until the destroy () session exists.
source
share