isset($_SESSION['foo']) vs $this->session->has_userdata('foo') |
Hello,
I'm just starting to use CI, and I'm wondering what's the good way of dealing with session. I wrote things like that so far : PHP Code: $this->session->foo = 'bar'; But in the doc, there is a note : Quote:This is a legacy method kept only for backwards compatibility with older applications. It is just an alias for isset($_SESSION[$key]) - please use that instead. I'm not sure to understand why the use of has_userdata is not recommended. Why can I use a magic object "session" to set and retrieve data from the session, and why I should access directly to the plain vanilla $_SESSION array to test if a key exists. Could someone explain me what should I use ? Thanks !
|
Welcome Guest, Not a member yet? Register Sign In |