class CI_Session 
- 
userdata([$key = NULL]) - 
Parameters: - $key (mixed) – Session item key or NULL
 
Returns: Value of the specified item key, or an array of all userdata
Return type: mixed
Gets the value for a specific
$_SESSIONitem, or an array of all “userdata” items if not key was specified.Note
This is a legacy method kept only for backwards compatibility with older applications. You should directly access
$_SESSIONinstead. 
- 
all_userdata() - 
Returns: An array of all userdata Return type: array Returns an array containing all “userdata” items.
Note
This method is DEPRECATED. Use
userdata()with no parameters instead. 
- 
&get_userdata() - 
Returns: A reference to $_SESSIONReturn type: array Returns a reference to the
$_SESSIONarray.Note
This is a legacy method kept only for backwards compatibility with older applications.
 
- 
has_userdata($key) - 
Parameters: - $key (string) – Session item key
 
Returns: TRUE if the specified key exists, FALSE if not
Return type: bool
Checks if an item exists in
$_SESSION.Note
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. 
- 
set_userdata($data[, $value = NULL]) - 
Parameters: - $data (mixed) – An array of key/value pairs to set as session data, or the key for a single item
 - $value (mixed) – The value to set for a specific session item, if $data is a key
 
Return type: void
Assigns data to the
$_SESSIONsuperglobal.Note
This is a legacy method kept only for backwards compatibility with older applications.
 
- 
unset_userdata($key) - 
Parameters: - $key (mixed) – Key for the session data item to unset, or an array of multiple keys
 
Return type: void
Unsets the specified key(s) from the
$_SESSIONsuperglobal.Note
This is a legacy method kept only for backwards compatibility with older applications. It is just an alias for
unset($_SESSION[$key])- please use that instead. 
- 
mark_as_flash($key) - 
Parameters: - $key (mixed) – Key to mark as flashdata, or an array of multiple keys
 
Returns: TRUE on success, FALSE on failure
Return type: bool
Marks a
$_SESSIONitem key (or multiple ones) as “flashdata”. 
- 
get_flash_keys() - 
Returns: Array containing the keys of all “flashdata” items. Return type: array Gets a list of all
$_SESSIONthat have been marked as “flashdata”. 
- 
unmark_flash($key) - 
Parameters: - $key (mixed) – Key to be un-marked as flashdata, or an array of multiple keys
 
Return type: void
Unmarks a
$_SESSIONitem key (or multiple ones) as “flashdata”. 
- 
flashdata([$key = NULL]) - 
Parameters: - $key (mixed) – Flashdata item key or NULL
 
Returns: Value of the specified item key, or an array of all flashdata
Return type: mixed
Gets the value for a specific
$_SESSIONitem that has been marked as “flashdata”, or an array of all “flashdata” items if no key was specified.Note
This is a legacy method kept only for backwards compatibility with older applications. You should directly access
$_SESSIONinstead. 
- 
keep_flashdata($key) - 
Parameters: - $key (mixed) – Flashdata key to keep, or an array of multiple keys
 
Returns: TRUE on success, FALSE on failure
Return type: bool
Retains the specified session data key(s) as “flashdata” through the next request.
Note
This is a legacy method kept only for backwards compatibility with older applications. It is just an alias for the
mark_as_flash()method. 
- 
set_flashdata($data[, $value = NULL]) - 
Parameters: - $data (mixed) – An array of key/value pairs to set as flashdata, or the key for a single item
 - $value (mixed) – The value to set for a specific session item, if $data is a key
 
Return type: void
Assigns data to the
$_SESSIONsuperglobal and marks it as “flashdata”.Note
This is a legacy method kept only for backwards compatibility with older applications.
 
- 
mark_as_temp($key[, $ttl = 300]) - 
Parameters: - $key (mixed) – Key to mark as tempdata, or an array of multiple keys
 - $ttl (int) – Time-to-live value for the tempdata, in seconds
 
Returns: TRUE on success, FALSE on failure
Return type: bool
Marks a
$_SESSIONitem key (or multiple ones) as “tempdata”. 
- 
get_temp_keys() - 
Returns: Array containing the keys of all “tempdata” items. Return type: array Gets a list of all
$_SESSIONthat have been marked as “tempdata”. 
- 
unmark_temp($key) - 
Parameters: - $key (mixed) – Key to be un-marked as tempdata, or an array of multiple keys
 
Return type: void
Unmarks a
$_SESSIONitem key (or multiple ones) as “tempdata”. 
- 
tempdata([$key = NULL]) - 
Parameters: - $key (mixed) – Tempdata item key or NULL
 
Returns: Value of the specified item key, or an array of all tempdata
Return type: mixed
Gets the value for a specific
$_SESSIONitem that has been marked as “tempdata”, or an array of all “tempdata” items if no key was specified.Note
This is a legacy method kept only for backwards compatibility with older applications. You should directly access
$_SESSIONinstead. 
- 
set_tempdata($data[, $value = NULL]) - 
Parameters: - $data (mixed) – An array of key/value pairs to set as tempdata, or the key for a single item
 - $value (mixed) – The value to set for a specific session item, if $data is a key
 - $ttl (int) – Time-to-live value for the tempdata item(s), in seconds
 
Return type: void
Assigns data to the
$_SESSIONsuperglobal and marks it as “tempdata”.Note
This is a legacy method kept only for backwards compatibility with older applications.
 
- 
sess_regenerate([$destroy = FALSE]) - 
Parameters: - $destroy (bool) – Whether to destroy session data
 
Return type: void
Regenerate session ID, optionally destroying the current session’s data.
Note
This method is just an alias for PHP’s native session_regenerate_id() function.
 
- 
sess_destroy() - 
Return type: void Destroys the current session.
Note
This must be the last session-related function that you call. All session data will be lost after you do that.
Note
This method is just an alias for PHP’s native session_destroy() function.
 
- 
__get($key) - 
Parameters: - $key (string) – Session item key
 
Returns: The requested session data item, or NULL if it doesn’t exist
Return type: mixed
A magic method that allows you to use
$this->session->iteminstead of$_SESSION['item'], if that’s what you prefer.It will also return the session ID by calling
session_id()if you try to access$this->session->session_id. 
- 
__set($key, $value) - 
Parameters: - $key (string) – Session item key
 - $value (mixed) – Value to assign to the session item key
 
Returns: void
A magic method that allows you to assign items to
$_SESSIONby accessing them as$this->sessionproperties:$this->session->foo = 'bar'; // Results in: // $_SESSION['foo'] = 'bar';
 
Please login to continue.