Fatal error: Call to undefined method CookieCompon

2020-05-06 14:08发布

Hi to all I have this strange error in my code. I want to make a cookie system with cakephp, and in app_controller.php I include

var $components = array('Auth', 'Cookie'); var $helpers = array('Html', 'Form', 'Session');

but everytime I click on Logout link the error appears. This is the function

function logout() { $cookie = $this->Cookie->read('User'); if($cookie) $this->Cookie->del('User'); $this->Session->setFlash('Logout'); $this->redirect($this->Auth->logout()); }

Where I can look for a solution? Thank you dude

标签: cakephp
1条回答
够拽才男人
2楼-- · 2020-05-06 14:47

The method name is delete, not del, hence the error. See also http://api.cakephp.org/class/cookie-component#method-CookieComponentdelete

查看更多
登录 后发表回答