The CakePHP session component provides a way to persist client data between page requests. It acts as a wrapper for the $_SESSION as well as providing convenience methods for several $_SESSION related functions.
Syntex for write session is :
$this->Session->write('variable','value');
Syntex for check session is set or not (it gives true or false value) :-
if(isset('$_SESSION'))
{........}
If there are more then one session running ,then check session according to variable's value :-
if($_SESSION['variable'] == 'value')
{.....}
If you wish to delete some session data, you can use the unset() or the destroy() function.
The unset() function is used to free the specified session variable:
unset($_SESSION('variable'));
You can also completely destroy the all the running session by calling destroy() function:
$this->session->destroy();
Syntex for write session is :
$this->Session->write('variable','value');
Syntex for check session is set or not (it gives true or false value) :-
if(isset('$_SESSION'))
{........}
If there are more then one session running ,then check session according to variable's value :-
if($_SESSION['variable'] == 'value')
{.....}
If you wish to delete some session data, you can use the unset() or the destroy() function.
The unset() function is used to free the specified session variable:
unset($_SESSION('variable'));
You can also completely destroy the all the running session by calling destroy() function:
$this->session->destroy();
No comments:
Post a Comment