I am starting work with CakePHP 3.x but when i am trying to check session variable first time, getting following error.
Fatal error: Call to a member function check() on null
i am using following code
$this->request->session->check('admin')
The above working fine in CakePHP 2.x but getting error in CakePHP 3.x.
Thanks.
Use $this->request->session()->check()
.
session()->
instead of session->
.
Docs: https://book.cakephp.org/3.0/en/development/sessions.html#accessing-the-session-object
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.