Home > Article > Backend Development > How to delete cookies in php
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.
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.
In the test.php file, use the setcookie() function to create a cookie named name.
In the test.php file, use echo to output the currently set cookie value, run the test.php file, and view the results.
In the test.php file, use the setcookie() function to expire the above cookie setting, that is, delete the cookie.
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"]
Open the test.php file in the browser to view the results.
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!