Delete PHP Cookie?

前端 未结 3 1263
醉梦人生
醉梦人生 2020-12-20 18:04

I currently have a cookie set as follows:

setcookie(\"username\",$username,time()+3600*24*5);

How would I go about clearing the value of th

3条回答
  •  囚心锁ツ
    2020-12-20 18:34

    Setting its expiration to some time in the past should clear it:

    setcookie("username",$username,time()-10);
    

    If you're using PHP sessions to manage users, you'll probably also want to session_destroy()

提交回复
热议问题