Home  >  Article  >  Backend Development  >  How to delete cookies in php

How to delete cookies in php

藏色散人
藏色散人Original
2020-08-29 10:31:492709browse

How to delete cookies in php: 1. Use the "setcookie('cookiename', '')" method to set the cookie value to empty; 2. Use the "setcookie('cookiename', '', time( )-3600);" method.

How to delete cookies in php

Recommendation: "PHP Video Tutorial"

Two ways to delete/clear cookies in php

Set the cookie value to empty, that is: setcookie('cookiename', '') or setcookie(cookiename, NULL);

Set the cookie expiration time to the past, that is: setcookie ('cookiename','',time()-3600);

Method 1: Set the cookie value to empty

";
echo "You have successfully logged out.";
?>

Second method: Set the cookie expiration time to the past

";
echo "You have successfully logged out.";
?>

The above is the detailed content of How to delete cookies in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn