thinkphp+dwz升级cluster版后弹出Object object无法刷新页面解决办法

因为cluster版的ThinkPHP\Lib\Core\Action.class.php里的ajaxReturn()的方法变了

所以要修改一下

protected function ajaxReturn($data,$type='') {
        if(func_num_args()>2) {// 兼容3.0之前用法
            $args           =   func_get_args();
            array_shift($args);
            $info           =   array();
            $info['data']   =   $data;
            $info['info']   =   array_shift($args);
            $info['status'] =   array_shift($args);
            $data           =   $info;
            $type           =   $args?array_shift($args):'';
        }
        $data['statusCode'] = 1; // [email protected]
        $data['navTabId'] = $_REQUEST['navTabId'];// [email protected]
        $data['rel'] = $_REQUEST['rel']; // [email protected]
        $data['callbackType'] = $_REQUEST['callbackType']; // [email protected]
        $data['forwardUrl'] = $_REQUEST['forwardUrl']; // [email protected]
        $data['confirmMsg'] = $_REQUEST['confirmMsg'];// [email protected]
        $data['message'] = $data['info']; // [email protected]
        if(empty($type)) $type  =   C('DEFAULT_AJAX_RETURN');
        switch (strtoupper($type)){
            case 'JSON' :
                // 返回JSON数据格式到客户端 包含状态信息
                header('Content-Type:application/json; charset=utf-8');
                exit(json_encode($data));
            case 'XML'  :
                // 返回xml格式数据
                header('Content-Type:text/xml; charset=utf-8');
                exit(xml_encode($data));
            case 'JSONP':
                // 返回JSON数据格式到客户端 包含状态信息
                header('Content-Type:application/json; charset=utf-8');
                $handler  =   isset($_GET[C('VAR_JSONP_HANDLER')]) ? $_GET[C('VAR_JSONP_HANDLER')] : C('DEFAULT_JSONP_HANDLER');
                exit($handler.'('.json_encode($data).');');  
            case 'EVAL' :
                // 返回可执行的js脚本
                header('Content-Type:text/html; charset=utf-8');
                exit($data);            
            default     :
                // 用于扩展其他返回格式数据
                tag('ajax_return',$data);
        }
    }

云端的扩展文件也要修改

ThinkPHP\Extend\Engine\Cluster\Lib\Core\Action.class.php

    protected function ajaxReturn($data,$type='') {
        if(func_num_args()>2) {// 兼容3.0之前用法
            $args           =   func_get_args();
            array_shift($args);
            $info           =   array();
            $info['data']   =   $data;
            $info['info']   =   array_shift($args);
            $info['status'] =   array_shift($args);
            $data           =   $info;
            $type           =   $args?array_shift($args):'';
        }
        $data['statusCode'] = 1; // [email protected]
        $data['navTabId'] = $_REQUEST['navTabId'];// [email protected]
        $data['rel'] = $_REQUEST['rel']; // [email protected]
        $data['callbackType'] = $_REQUEST['callbackType']; // [email protected]
        $data['forwardUrl'] = $_REQUEST['forwardUrl']; // [email protected]
        $data['confirmMsg'] = $_REQUEST['confirmMsg'];// [email protected]
        $data['message'] = $data['info']; // [email protected]
        if(empty($type)) $type  =   C('DEFAULT_AJAX_RETURN');
        switch (strtoupper($type)){
            case 'JSON' :
                // 返回JSON数据格式到客户端 包含状态信息
                header('Content-Type:application/json; charset=utf-8');
                exit(json_encode($data));
            case 'XML'  :
                // 返回xml格式数据
                header('Content-Type:text/xml; charset=utf-8');
                exit(xml_encode($data));
            case 'JSONP':
                // 返回JSON数据格式到客户端 包含状态信息
                header('Content-Type:application/json; charset=utf-8');
                $handler  =   isset($_GET[C('VAR_JSONP_HANDLER')]) ? $_GET[C('VAR_JSONP_HANDLER')] : C('DEFAULT_JSONP_HANDLER');
                exit($handler.'('.json_encode($data).');');  
            case 'EVAL' :
                // 返回可执行的js脚本
                header('Content-Type:text/html; charset=utf-8');
                exit($data);            
            default     :
                // 用于扩展其他返回格式数据
                tag('ajax_return',$data);
        }
    }



 

你可能感兴趣的:(thinkphp+dwz升级cluster版后弹出Object object无法刷新页面解决办法)