From c1ee65ba12164141b18aac49b0f210ed161f88b9 Mon Sep 17 00:00:00 2001
From: Derek Allard
Where $array is an associative array containing your new data. Here's an example:
-$newdata = array(
- 'username' => 'johndoe',
- 'email' => 'johndoe@some-site.com',
- 'logged_in' => TRUE
- );
-
-$this->session->set_userdata($newdata);
-
+$newdata = array(
+ 'username' => 'johndoe',
+ 'email' => 'johndoe@some-site.com',
+ 'logged_in' => TRUE
+ );
+
+ $this->session->set_userdata($newdata);
If you want to add userdata one value at a time, set_userdata() also supports this syntax.
+$this->session->set_userdata('some_name', 'some_value');
Note: Cookies can only hold 4KB of data, so be careful not to exceed the capacity. The encryption process in particular produces a longer data string than the original so keep careful track of how much data you are storing.
-- cgit v1.2.3-24-g4f1b