Friday 31 October 2014

How to unset cookie in php?

A clean way to delete a cookie is to clear both of $_COOKIE value and browser cookie file :

if(isset($_COOKIE['key'])) {
  unset($_COOKIE['key']);
  setcookie('key', '', time() - 3600); // empty value and old timestamp
}

No comments:

Post a Comment

Disable Caching Drupal 8

1. Copy and rename the sites/example.settings.local.php to sites/default/settings.local.php: $ cp sites / example . settings . local . ph...