mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
改进Response类 增加think\response\View类 用于渲染模板响应输出
This commit is contained in:
@@ -13,6 +13,8 @@ namespace think;
|
||||
|
||||
use think\exception\HttpResponseException;
|
||||
use think\Response;
|
||||
use think\response\Json;
|
||||
use think\response\Jsonp;
|
||||
|
||||
/**
|
||||
* App 应用管理
|
||||
@@ -117,8 +119,20 @@ class App
|
||||
// 监听app_end
|
||||
APP_HOOK && Hook::listen('app_end', $data);
|
||||
$type = IS_AJAX ? Config::get('default_ajax_return') : Config::get('default_return_type');
|
||||
switch ($type) {
|
||||
case 'json':
|
||||
$response = new Json($data);
|
||||
break;
|
||||
case 'jsonp':
|
||||
$response = new Jsonp($data);
|
||||
break;
|
||||
case 'html':
|
||||
default:
|
||||
$response = new Response($data, $type);
|
||||
break;
|
||||
}
|
||||
// 自动响应输出
|
||||
return Response::create($type)->send($data);
|
||||
return $response->send();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user