• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I can't delete cookie in Codeigniter.

#1
[eluser]Unknown[/eluser]
I set cookie like this code.

Code:
setcookie('username','aaa');
setcookie('password','123');

I try to delete cookie like userguide but it can't delete cookie. I'm not sure why I can't delete cookie. please help me.

This is logout function in Controller.

Code:
function logout()
{
      delete_cookie('username');
      delete_cookie('password');

     redirect('login/form_login','refresh');
}

This is my form in View.

Code:
if(get_cookie('username')){
   echo "You are logged in ".get_cookie('username');
?>
     <a href="&lt;?php echo site_url() . '/login/logout'; ?&gt;">Logout</a>
&lt;?
}
else{
     echo "You are not log in.";
}
?&gt;

After I click at Logout. It not delete cookie.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.