1. UTF-8编码解决反序列化出错问题

function mb_unserialize($serial_str) {
    $serial_str = str_replace("\r", "", $serial_str);
    $serial_str = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str );
    return unserialize($serial_str);
}

2.ASC编码解决反序列化出错问题 

function asc_unserialize($serial_str) {
 $serial_str= str_replace("\r", "", $serial_str);
 $serial_str = preg_replace('!s:(\d+):"(.*?)";!se', '"s:".strlen("$2").":\"$2\";"', $serial_str );
 return unserialize($serial_str);
}

 

相关文章:

  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
  • 2021-08-27
  • 2022-12-23
  • 2022-02-23
  • 2021-10-01
猜你喜欢
  • 2021-10-11
  • 2022-12-23
  • 2021-10-20
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案