Home > Mobile >  How to delete cookies in codeigniter 4 with helper? [closed]
How to delete cookies in codeigniter 4 with helper? [closed]

Time:09-17

I apply this method in ci4 to delete_cookie but it can't work.

if(delete_cookie(get_cookie("urs_name"))){
            echo "coookie deleted";
        }else{
            echo "Unable to delete cookies";
        }

Anyone can help one.

CodePudding user response:

Try this :

delete_cookie('name', $domain, $path); 

see this link

CodePudding user response:

This is the code to delete a cookie in PHP.

<?php
if(isset($_COOKIE['urs_name'])){
    echo "coookie deleted";
    setcookie ”urs_name”, "", time() - 3600);
}else{
    echo "Unable to delete cookies";
}
?>  

I wrote this on Aug 8 I just edited code Aug 9 realizing you are using codeigniter-4 you can use PHP to do the same thing just replaced by code with your coat.

CodePudding user response:

Do like that

helper('cookie');
delete_cookie('cookiename')
  • Related