致命错误:调用未定义的方法CookieComponent :: del() [英] Fatal error: Call to undefined method CookieComponent::del()
问题描述
您好到所有
我在我的代码中有这个奇怪的错误。
我想使用cakephp创建一个cookie系统,并且在app_controller.php中包含
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');
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');
$ it-> Session-> setFlash('Logout');
$ this-> redirect($ this-> Auth-> logout());
}
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
推荐答案
方法名称 delete
,而不是 del
,因此会出错。另请参见 http://api.cakephp.org/class/cookie-component#method -CookieComponentdelete
The method name is delete
, not del
, hence the error. See also http://api.cakephp.org/class/cookie-component#method-CookieComponentdelete
这篇关于致命错误:调用未定义的方法CookieComponent :: del()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!