通过php<code>setcookie()</code>第三个参数设置cookie过期时间来删除cookie,代码如下:
if($_COOKIE['username']!=""&&$_COOKIE[‘pwd’]!=""){
if(isset($_GET[cookie])){
setcookie("username","",time()-1);
setcookie("pwd","",time()-1);
setcookie("IP","",time()-1);
echo"<script>alert("cookie已经删除");location.href="index.php"</script>"
}
}