-2

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.

  • https://stackoverflow.com/questions/686155/remove-a-cookie – Nero Aug 28 '21 at 07:10
  • Does this answer your question? [How to delete cookie on codeigniter](https://stackoverflow.com/questions/18565336/how-to-delete-cookie-on-codeigniter) – David Jones Aug 29 '21 at 10:24
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 31 '21 at 13:14

3 Answers3

1

Try this :

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

see this link

yecademy
  • 37
  • 7
0

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.

NhlGreg
  • 67
  • 6
  • Please provide additional details in your answer. As it's currently written, it's hard to understand your solution. – Community Aug 29 '21 at 06:33
0

Do like that

helper('cookie');
delete_cookie('cookiename')
Abhishek Gurjar
  • 7,426
  • 10
  • 37
  • 45
paliz
  • 347
  • 2
  • 5