phpcodeigniter-3session-variables

Why can't I see the session variables set previously?


I have two processes. The first (#1) sets some session variables and also creates a cookie with the session_id in it. The second (#2)reads the cookie and runs this code:

session_id($_COOKIE['cookie_session']);
session_start();

I stop the code after the session start and I then look with the debugger at the $_SESSION (in #2). All I see in the is _ci_last_regenerate. My session variables are not in there. Why?


Solution

  • to set the session in codeigniter 3 all you have to do is:

    $this->load->library( 'session' );
    $this->session->set_userdata( 'namesession', 'information_on_session');