反序列化返回false

时间:2012-08-03 13:47:37

标签: serialization

为什么unserialize函数返回false:

一个:1:{I:0;一个:2:{S:4:\ “类型\”; S:6:\ “isisbn \”; S:2:\ “ID \”; S:2 :\ “85 \”;}}

代码:

        if (unserialize($stringTempList)) {
            return unserialize($stringTempList);
        }else{
            $this->messageBad[] = 'unserialize failed';
        }

1 个答案:

答案 0 :(得分:0)

通过运行stripslashes()

解决

代码:

    if (unserialize(stripslashes($stringTempList))) {
        return unserialize(stripslashes($stringTempList));
    }else{
        $this->messageBad[] = 'unserialize failed';
    }