How to delete cookies in php

藏色散人
Release: 2023-03-09 16:22:02
Original
2715 people have browsed it

How to delete cookies in php: first create a new php file; then use the setcookie() function to create a cookie named name; finally use the setcookie() function to expire the cookie setting to delete the cookie.

How to delete cookies in php

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

Create a new php file and name it test.php. Used to explain how to delete cookies in PHP.

How to delete cookies in php

In the test.php file, use the setcookie() function to create a cookie named name.

How to delete cookies in php

In the test.php file, use echo to output the currently set cookie value, run the test.php file, and view the results.

How to delete cookies in php

In the test.php file, use the setcookie() function to expire the above cookie setting, that is, delete the cookie.

How to delete cookies in php

In the test.php file, use the if statement to determine whether the cookie has been successfully deleted, and use echo to output the result. [Recommended learning: "PHP Video Tutorial"]

How to delete cookies in php

Open the test.php file in the browser to view the results.

How to delete cookies in php

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!