$value){etCookie($key,"",time()-60);}" Just cookies."/> $value){etCookie($key,"",time()-60);}" Just cookies.">
Home > Article > Backend Development > How to clear all cookies in php
php method to clear all cookies: first create a PHP sample file; then pass "foreach($_COOKIE as $key=>$value){etCookie($key,"",time()-60 );}" Just delete multiple cookies.
#The example in this article describes the simple implementation method of deleting cookies in batches in PHP.
The code is as follows:
<?php //删除单个cookie:键值设置为空、时间设置为过期了的时间 setCookie("name","",time()-60); //删除多个cookie,采用遍历数组方式 foreach($_COOKIE as $key=>$value){ setCookie($key,"",time()-60); } ?>
Knowledge points: If all cookies of a website are deleted, the file that saves the cookies of the website will also be deleted; if only one of them is deleted cookie, only the cookie information in the file is deleted.
[Recommended: "PHP Video Tutorial"]
The above is the detailed content of How to clear all cookies in php. For more information, please follow other related articles on the PHP Chinese website!