Remove a cookie

后端 未结 22 1268
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 16:16

When I want to remove a Cookie I try

unset($_COOKIE[\'hello\']);

I see in my cookie browser from firefox that the cookie still exists. How

22条回答
  •  清酒与你
    2020-11-22 16:34

    Set the value to "" and the expiry date to yesterday (or any date in the past)

    setcookie("hello", "", time()-3600);
    

    Then the cookie will expire the next time the page loads.

提交回复
热议问题