控制器的error success result redirect方法均不需要使用return

This commit is contained in:
thinkphp
2016-07-24 20:56:21 +08:00
parent 92e5ca0226
commit bab4398552

View File

@@ -31,7 +31,7 @@ trait Jump
* @param string $url 跳转的URL地址 * @param string $url 跳转的URL地址
* @param mixed $data 返回的数据 * @param mixed $data 返回的数据
* @param integer $wait 跳转等待时间 * @param integer $wait 跳转等待时间
* @return array * @return void
*/ */
protected function success($msg = '', $url = null, $data = '', $wait = 3) protected function success($msg = '', $url = null, $data = '', $wait = 3)
{ {
@@ -58,7 +58,8 @@ trait Jump
$result = ViewTemplate::instance(Config::get('template'), Config::get('view_replace_str')) $result = ViewTemplate::instance(Config::get('template'), Config::get('view_replace_str'))
->fetch(Config::get('dispatch_success_tmpl'), $result); ->fetch(Config::get('dispatch_success_tmpl'), $result);
} }
return Response::create($result, $type); $response = Response::create($result, $type);
throw new HttpResponseException($response);
} }
/** /**
@@ -106,7 +107,7 @@ trait Jump
* @param integer $code 返回的code * @param integer $code 返回的code
* @param mixed $msg 提示信息 * @param mixed $msg 提示信息
* @param string $type 返回数据格式 * @param string $type 返回数据格式
* @return mixed * @return void
*/ */
protected function result($data, $code = 0, $msg = '', $type = '') protected function result($data, $code = 0, $msg = '', $type = '')
{ {
@@ -117,7 +118,8 @@ trait Jump
'data' => $data, 'data' => $data,
]; ];
$type = $type ?: $this->getResponseType(); $type = $type ?: $this->getResponseType();
return Response::create($result, $type); $response = Response::create($result, $type);
throw new HttpResponseException($response);
} }
/** /**