Remove a cookie

后端 未结 22 1580
没有蜡笔的小新
没有蜡笔的小新 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:33

    You have to delete cookies with php in your server and also with js for your browser.. (They has made with php, but cookie files are in the browser client too):

    An example:

    if ($_GET['action'] == 'exit'){
                // delete cookies with js and then in server with php:
                echo '
                
                ';
    unset($_COOKIE['cookie_name']);
    unset($_COOKIE['cookie_time']);
    

提交回复
热议问题