php cookie doesn't update

前端 未结 5 549
遥遥无期
遥遥无期 2021-01-21 17:08

I need to update a cookie. I do that in a php file called via ajax. This is is the code:

setcookie(\'items[\'.$_POST[\'id\'].\']\');

The cookie

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-21 17:29

    When you use setcookie is doesn't add the cookie to the superglobal $_COOKIE. You will have to do that yourself or reload the page. Also, since you are setting the cookie with an empty value, nothing would be set.

提交回复
热议问题