PHP Unserialize Offset Error
I have this code:
$serialized = $_POST['cartSer'];
echo $serialized;
Which prints this:
a:1:{s:15:\"test\";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
What am I doing wrong with the unserialize?
Sounds like you have magic quotes enabled. Either disable them, or run your value through stripslashes
$serialized = stripslashes($_POST['cartSer']);
精彩评论