php cookie doesn't update

前端 未结 5 500
遥遥无期
遥遥无期 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:22

    You have to set the value for the key to access with $_COOKIE:

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

    Link to manual

提交回复
热议问题