【发布时间】:2021-03-08 03:31:37
【问题描述】:
我已经设置了最新的蛋糕 ph 设置,当我尝试登录用户时,它给了我这个错误
传递给 Cake\Http\Session::_overwrite() 的参数 1 必须是数组类型,给定 null
我的代码是
$user = $this->Auth->identify();
if ($user) {
$this->Auth->setUser($user);
return $this->redirect($this->Auth->redirectUrl());
} else {
$this->Flash->error(__('Username or password is incorrect'));
}
当我检查 $user 时,它给了我已识别的用户,但后来它给了我上述错误。
【问题讨论】:
-
@Salines 谢谢你,但我已经提到了这个,但找不到解决方案
-
当您收到错误时,请发布 complete 错误消息,并包含相关的堆栈跟踪(您可以在 CakePHP
/logs/中找到两者)!在您的特定情况下,您应该检查所有错误(清除日志、运行代码、检查日志),因为您的问题意味着$_SESSION超全局是null,这意味着会话可能未正确启动,这可能是由于其他错误。
标签: cakephp cakephp-4.x