[英]cakephp3 session deprecated
I have update into my project the last version of cakephp core. 我已经在我的项目中更新了cakephp核心的最新版本。 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 谢谢
if ($this->request->session->read('admin_logged_in')){
should be fine. 应该没事。
UPDATE UPDATE
As per the comment of @raph below the correct answer is 根据下面@raph的评论,正确的答案是
$this->request->session()->read('admin_logged_in')
Note the () after session 注意会话后的()
In Cakehp 3.7, use getSession() instead. 在Cakehp 3.7中,使用getSession()代替。
$this->request->getSession()->read('admin_logged_in');
Ref: https://book.cakephp.org/3.0/en/development/sessions.html 参考: https : //book.cakephp.org/3.0/en/development/sessions.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.