R3m/framework Function reference session

{session(String $attribute=null, Mixed $value=null)}

Set or get the session ( as an array )/ part of the session (mixed).


{$session = session()}                                      // accessible $session.id, $session.csrf.
{$session.language = 'en'}                                  // wrong syntax.
{$language = session('language', 'en')}                     // right syntax and sets the language to en.
{session('delete','language')}                              // delete language attribute from session
{$nested = session('this.is.a.nested.variable', 'nested')}  // max 10 deep

Returns all the session as an array or in case of assignment an object.
Returns the value of an attribute set.
Deleting a session attribute doesn't return a value.

More information:


Last modified: 2021-06-07

© 2021 universeorange.com