开发者

check auth session in controller

开发者 https://www.devze.com 2023-01-21 11:46 出处:网络
I have used Auth component in my cakephp site. I want to check whether au开发者_运维问答th session is there or not from controller.

I have used Auth component in my cakephp site. I want to check whether au开发者_运维问答th session is there or not from controller.

Please help.


You can access Auth component by $this->Auth from the controller.

$this->Auth->user() will give you the currently authenticated user. The information is taken from the session. If this method returns null, the user is not logged in.

0

精彩评论

暂无评论...
验证码 换一张
取 消