您的位置:首页 > 移动开发 > Objective-C

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

2013-03-09 17:02 337 查看
因为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; // 96012@qq.com
$data['navTabId'] = $_REQUEST['navTabId'];// 96012@qq.com
$data['rel'] = $_REQUEST['rel']; // 96012@qq.com
$data['callbackType'] = $_REQUEST['callbackType']; // 96012@qq.com
$data['forwardUrl'] = $_REQUEST['forwardUrl']; // 96012@qq.com
$data['confirmMsg'] = $_REQUEST['confirmMsg'];// 96012@qq.com
$data['message'] = $data['info']; // 96012@qq.com
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; // 96012@qq.com
$data['navTabId'] = $_REQUEST['navTabId'];// 96012@qq.com
$data['rel'] = $_REQUEST['rel']; // 96012@qq.com
$data['callbackType'] = $_REQUEST['callbackType']; // 96012@qq.com
$data['forwardUrl'] = $_REQUEST['forwardUrl']; // 96012@qq.com
$data['confirmMsg'] = $_REQUEST['confirmMsg'];// 96012@qq.com
$data['message'] = $data['info']; // 96012@qq.com
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);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐