2

How can i make a cookie removed while someone clicks the logout button?

Here is the code which i used but didn't work through:

<?php
setcookie('name','value',time()-600, '/', '', 0);
?>

Since I am not that much expert in PHP. Any Help?

Aadarsha
  • 75
  • 8

1 Answers1

6
if (isset($_COOKIE['name'])) {
    unset($_COOKIE['name']);
    setcookie('name', null, -1, '/');
}
thecodeparadox
  • 86,271
  • 21
  • 138
  • 164