Skip to content

Session

kaythinks edited this page Apr 11, 2020 · 1 revision

The Session class has 5 methods namely,


public static function all()

This method is used for getting all values in the global $_SESSION variable. It can be accessed like this, Session::all()


public static function get(string $name)

This method is used for getting a single value in the global $_SESSION variable. It can be accessed like this, Session::get('value')


public static function put(string $name, $input)

This method is used for putting value in the global $_SESSION variable. It can be accessed like this, Session::put('error','Invalid Login or Password !');


public static function exists(string $name) : bool

This method is for checking if a key exists in the global $_SESSION variable. It can be accessed like this, Session::exists('info')


public static function destroy(string $name)

This method is for removing a key from a Session, it can be accessed like this, Session::destroy('error');

Clone this wiki locally