JSession/clear
From Joomla! Documentation
< API16:JSession
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Unset data from the session store
Syntax[edit]
clear($name, $namespace= 'default')
Parameter Name | Default Value | Description |
---|---|---|
$name | Name of variable | |
$namespace | 'default' | Namespace to use, default to 'default' |
Returns[edit]
mixed The value from session or NULL if not set
Defined in[edit]
libraries/joomla/session/session.php
Importing[edit]
jimport( 'joomla.session.session' );
Source Body[edit]
public function clear($name, $namespace = 'default')
{
$namespace = '__'.$namespace; //add prefix to namespace to avoid collisions
if ($this->_state !== 'active') {
// @TODO :: generated error here
return null;
}
$value = null;
if (isset($_SESSION[$namespace][$name])) {
$value = $_SESSION[$namespace][$name];
unset($_SESSION[$namespace][$name]);
}
return $value;
}
Examples[edit]
Code Examples[edit]