Session component provides a way to persist the data between HTTP requests.
We can put any value to name and by this way we can write the session.
SessionComponent::write($name, $value)
$this->Session->write('User.fruit, 'apple');
Which writes the value apple to the name fruit under user.Means User=>fruit
SessionComponent::read($name)
$var = $this->Session->read('User.fruit');
We can read the session with the help of session component read function which has one parameter. it returns the value $name in the session.
SessionComponent::delete($name)
$this->Session->delete('User.fruit');
It clear the session data
SessionComponent::destroy()
$this->Session->destroy();
It will delete the all session data.we can destroy the php session and create a fresh session.
0 Comment(s)