Create array in cookie with javascript

后端 未结 9 891
-上瘾入骨i
-上瘾入骨i 2020-12-08 10:32

Is it possible to create a cookie using arrays?

I would like to store a[0]=\'peter\', a[\'1\']=\'esther\', a[\'2\']=\'john\' i

9条回答
  •  隐瞒了意图╮
    2020-12-08 11:01

    Cookies can hold only strings. If you want to simulate an array you need to serialize it and deserialize it.

    You could do this with a JSON library.

提交回复
热议问题