开发者

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']);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜