setcookie to an empty value not working

前端 未结 5 2085
天涯浪人
天涯浪人 2020-12-21 06:46

i have this code im trying to do for a type of cache system so it remembers the city the user has selected. if the user has selected a city it stores it in sessions and cook

5条回答
  •  情话喂你
    2020-12-21 07:37

    You can set empty value to the cookie by using null pointer as the value

    like this:

        setrawcookie('testEmptyCookie', "\x00", time() + 3600, '/');
    

    (tried on php 5.6, 7.2)

提交回复
热议问题