Heim >Backend-Entwicklung >PHP-Tutorial >懂cakephp的帮忙看一下这段cakephp的代码,为什么AuthComponent:user('id')取不到值,该怎么解决
懂cakephp的帮忙看一下这段cakephp的代码,为什么AuthComponent::user('id')取不到值
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->function login(){ if(empty($this->request->data['User']['username']) or empty($this->request->data['User']['password'])){ $this->Session->setFlash('Please intyped a valied account!'); }elseif ($this->Auth->login($this->request->data['User'])) { $this->User->id= AuthComponent::user('id'); $this->redirect("/users/index"); } else{ $this->redirect("/users/logout"); } }