将JSON字符串存储到shopware商店cookie

时间:2017-07-14 09:13:20

标签: php json cookies shopware

如何将json字符串传递给cookie? 我在shopware插件的Subscriber文件夹中有这样的东西:

$arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5);
$this->setCookie($controller,json_encode($arr));

但它存储以下字符串:

%7B%22a%22%3A1%2C%22b%22%3A2%2C%22c%22%3A3%2C%22d%22%3A4%2C%22e%22%3A5%7D

我知道问题出在php-json连接中。

0 个答案:

没有答案