西部数码主机 | 阿里云主机| 虚拟主机 | 服务器 | 返回乐道官网
当前位置: 主页 > php教程 > ecshop教程 >

修复ecshop专题商品unserialize函数计算错误

时间:2016-04-23 05:04来源:未知 作者:好模板 点击:
ecshop 专题添加商品不显示,因为编码差异引起unserialize函数长度计算错误,以下好模板分享该解决方法 1、ecshop文件admin/topic.php 找到: $topic[data] = addcslashes($topic[data], ); $topic[data] = $js

ecshop 专题添加商品不显示,因为编码差异引起unserialize函数长度计算错误,以下好模板分享该解决方法

1、ecshop文件admin/topic.php

找到:
        $topic['data'] = addcslashes($topic['data'], "'");
        $topic['data'] = $json->encode(@unserialize($topic['data']));
        $topic['data'] = addcslashes($topic['data'], "'");

替换为:

        $topic['data']= preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $topic['data'] );
        $topic['data']= str_replace("\r", "",$topic['data']);   
        $topic['data'] = addcslashes($topic['data'], "'");
        $topic['data'] = $json->encode(@unserialize($topic['data']));
        $topic['data'] = addcslashes($topic['data'], "'");

 

2、找到topic.php
找到:

$topic['data'] = addcslashes($topic['data'], "'");

替换为:


    $topic['data']= preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $topic['data'] );
    $topic['data']= str_replace("\r", "",$topic['data']);   
    $topic['data'] = addcslashes($topic['data'], "'");

(责任编辑:好模板)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------