authentication - 在 null 上调用成员函数 addUauthenticatedActions()(CakePHP 身份验证)
问题描述
我正在尝试实现 CMS 教程 - CakePHP 的身份验证,到目前为止我只是在尝试实现登录页面,但它在这一行给了我一个错误
$this->Authentication->addUnauthenticatedActions(['login']);
错误:在 null 上调用成员函数 addUnauthenticatedActions()
用户控制器:
public function beforeFilter(\Cake\Event\EventInterface $event){
parent::beforeFilter($event);
// Configure the login action to not require authentication, preventing
// the infinite redirect loop issue
$this->Authentication->addUnauthenticatedActions(['login']);
}
public function initialize() :void{
$this->loadComponent('Flash');
$this->loadComponent('Authentication.Authentication');
}
解决方案
推荐阅读
- android - 是否可以使用存储访问框架实现 Google Drive 文件夹选择器对话框?
- web-crawler - UnicodeDecodeError:“utf-8”编解码器无法解码位置 10208 中的字节 0xa0:无效的起始字节
- docker - 如何以非 root 用户身份构建 go docker 映像?
- json - 使用 jq 的 json 到 csv 问题
- javascript - 按键获取对象,保持键位
- python - 我们如何编写一个函数来获取文件名并在 pandas 中创建数据框?(没有 pandas 内置函数)
- asp.net -
我试图弄清楚这是如何工作的。在来自 VS 模板(Web 表单)的站点主文件中,我阅读了以下内容:
<asp:ScriptManager runat="server"> <Scripts> <asp:ScriptR
- c++ - C++ 递归函数
- python - 诗歌虚拟环境已激活
- reactjs - useEffect 操纵次要值