[英]PHP Unserialize Offset Error
I have this code: 我有这个代码:
$serialized = $_POST['cartSer'];
echo $serialized;
Which prints this: 打印这个:
a:1:{s:15:\\"test\\";s:3:\\"999\\";} 一个:1:{S:15:\\ “测试\\”; S:3:\\ “999 \\”;}
I then add this code: 然后我添加此代码:
echo unserialize($serialized);
And end up with this error: 并最终得到这个错误:
Notice: unserialize() [function.unserialize]: Error at offset 5 of 43 bytes in /mypage.php on line 5 注意:unserialize()[function.unserialize]:第5行/mypage.php中偏移量为5的43字节错误
What am I doing wrong with the unserialize? 我对unserialize做错了什么?
Sounds like you have magic quotes enabled. 听起来你启用了魔法引号 。 Either disable them, or run your value through stripslashes
要么禁用它们,要么通过stripslashes运行您的值
$serialized = stripslashes($_POST['cartSer']);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.