Skip to main content

Application::unsetSession

Unset SESSION data

Description

public void Application::unsetSession( [ string $name = "" ] )

Unset SESSION data. If you omit argument, unsetSession remove all SESSION data.

Arguments

NameData typeDefaultRemarks
$namestringSession param key

Example

Controller - First.php
$this->setSession('foo', 'bar');
Controller - Second.php
$this->getSession('foo'); // -> bar
Controller - Third.php
$this->unsetSession('foo');
echo $this->getSession('foo'); // -> ''

Remove all session datas

If you omit argument, unsetSession remove all SESSION data.

Controller - First.php
$this->setSession('foo', 'bar');
$this->setSession('baz', 'qux');
Controller - Second.php
$this->unsetSession();
echo $this->getSession('foo'); // -> ''
echo $this->getSession('baz'); // -> ''