2

I have update into my project the last version of cakephp core. Now I get this error:

Deprecated (16384): SessionHelper has been deprecated. Use request->session() instead. [CORE/src/View/Helper/sessionHelper.php, line 39]

The error I think is in this line:

if ($this->session->read('admin_logged_in')){

What should I use instead?

Thanks

4

2 回答 2

6
if ($this->request->session->read('admin_logged_in')){

应该没事。

更新

根据下面@raph 的评论,正确答案是

$this->request->session()->read('admin_logged_in')

注意会话后的 ()

于 2015-09-19T13:38:06.947 回答
1

在 Cakehp 3.7 中,使用 getSession() 代替。

$this->request->getSession()->read('admin_logged_in');

参考:https ://book.cakephp.org/3.0/en/development/sessions.html

于 2019-03-08T12:03:31.750 回答