diff options
author | Greg Aker <greg.aker@ellislab.com> | 2011-04-18 18:18:09 +0200 |
---|---|---|
committer | Greg Aker <greg.aker@ellislab.com> | 2011-04-18 18:18:09 +0200 |
commit | 3403366d0f457c1dd449076b4177d1aff5cb176c (patch) | |
tree | 74b002b1cf7c8f12da195e8893f036b3b916aec7 /user_guide/libraries | |
parent | 62df13125bd9ab22ff0c7f2565a42a6de13ed7e4 (diff) |
changeset: 2202:06a75a1bd622
tag: tip
user: Greg Aker <greg.aker@ellislab.com>
date: Mon Apr 18 11:10:37 2011 -0500
summary: Tweak to session class all_userdata() to just return the userdata array. Also documented previously undocumented all_userdata() method.
Diffstat (limited to 'user_guide/libraries')
-rw-r--r-- | user_guide/libraries/sessions.html | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/user_guide/libraries/sessions.html b/user_guide/libraries/sessions.html index 600d301c9..8d9c14eb6 100644 --- a/user_guide/libraries/sessions.html +++ b/user_guide/libraries/sessions.html @@ -170,6 +170,23 @@ having to run a database query when you need it.</p> <p class="important"><strong>Note:</strong> 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.</p> +<h2>Retrieving All Session Data</h2> +<p>An array of all userdata can be retrieved as follows:</p> +<code>$this->session->all_userdata()</code> + +<p>And returns an associative array like the following:</p> + +<pre> +Array +( + [session_id] => 4a5a5dca22728fb0a84364eeb405b601 + [ip_address] => 127.0.0.1 + [user_agent] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; + [last_activity] => 1303142623 +) +</pre> + + <h2>Removing Session Data</h2> <p>Just as set_userdata() can be used to add information into a session, unset_userdata() can be used to remove it, by passing the session key. For example, if you wanted to remove 'some_name' from your session information: </p> <p><code>$this->session->unset_userdata('some_name');</code></p> |