how to unset cookie in PHP?

前端 未结 6 454
旧时难觅i
旧时难觅i 2020-12-02 01:31

I need to figure out how to unset this cookie. Everything I tried so far has failed.

This is how I am currently unsetting it and it doesn\'t seem to work.

         


        
6条回答
  •  既然无缘
    2020-12-02 02:01

    Set the cookie's expiration date to a time in the past (like one second after epoch, for example).

    setcookie("yourCookie", "yourValue", 1);

    This will cause the cookie to expire.

    1 is used instead of 0, because 0 sets the cookie to expire at the end of the session.

提交回复
热议问题