PHP中unserialize()函数报 Error at offset解决方法

      发布在:后端技术      评论:0 条评论

Error at offset有可能是编码的问题可以自定义函数解决

function diy_unserialize($str){
$str=preg_replace_callback('#s:(\d+):"(.*?)";#s',function($match){return 's:'.strlen($match[2]).':"'.$match[2].'";';},$str);
return unserialize($str);
}


相关文章
热门推荐