In my different script (not using Codeigniter on this, but its on the same domain) I’m setting my session data this way:
<?php
session_start();
$_SESSION['something'] = 'test';
How comes it does works in that separated file but it doesn’t in the Codeigniter session?
When I’ll var_dump( $this->session->all_userdata() ); in any Codeigniter controller it doesn’t show my 'something' session data.
Whats wrong? Can it be done this way?
Codeigniter manages its own sessions, and has a few different storage methods ( it doesn’t necessarily use php’s native session storage as a backend).
You should still be able to access your
somethingvariable in codeigniter by doingIf you’re not worried about modifying the CI core, you can modify the session library to pull in data from $_SESSION.
A cleaner solution would be to write a hook that merges the native CI sessions with the default PHP $_SESSION superglobal.