Session in PHP
PHP Sessions allows you to identify unique users across requests and store persistent data for specific users against a unique session ID. This can be used to persist state information between page requests. Session IDs are normally sent to the browser via session cookies and the ID is used to retrieve existing session data.
Reading, Writing and Deleting session in Cakephp 3.x
You can access the session data any place you have access to a request object. This means the session is accessible from:
In addition to the basic session object, you can also use the Cake\View\Helper\SessionHelper to interact with the session in your views. A basic example of session usage would be:
$name = $this->request->session()->read('User.name');
// If you are accessing the session multiple times,
// you will probably want a local variable.
$session = $this->request->session();
$name = $session->read('User.name');
Reading, Writing and Deleting Session Data
Session::read($key) function is used to read specific session data in CakePHP.
Session::write($key, $value) function is used to write session data in CakePHP.
Session::delete($key) function is used to delete specific session data in CakePHP.
//Reading a session
//Writing a session
//Deleting a session