我是 cakephp 3.2 的新手。我已经使用 cakephp 代码登录,但是需要创建一个默认登录名(意味着无论数据库中存在什么登录 ID 和密码,如果我将给出默认登录用户名和密码,登录将起作用。)。
下面是代码
if(($data['email'] == 'admin@gmail.com') && ($data['password'] == '123456')) {
$getMasterLogin = $this->Users->find('all')->where(['Users.type' => 1])->first();
$user = $this->Auth->identify($getMasterLogin);//pj($user);exit;//alaway returnig false
//$this->Auth->setUser($user);
return $this->redirect(['action' => 'index']);
}
这里$this->Auth->identify
总是返回false。我已经按照烹饪书完成了登录部分,但我无法执行此默认登录。我非常需要它。对不起 。请给我建议。