From eb24c9fdee6b089e67c106417a242c857d30cb0f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 15 Feb 2016 19:41:20 +0800 Subject: [PATCH] =?UTF-8?q?error=E5=92=8Csuccess=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E7=9A=84url=E5=8F=82=E6=95=B0=E6=94=AF=E6=8C=81=E4=BC=A0?= =?UTF-8?q?=E5=85=A5=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Response.php | 18 +++++++++--------- library/traits/controller/Jump.php | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/library/think/Response.php b/library/think/Response.php index 87a1bcbf..4f985948 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -135,7 +135,7 @@ class Response * @access public * @param mixed $data 要返回的数据 * @param integer $code 返回的code - * @param mixed $msg 提示信息 + * @param string $msg 提示信息 * @param string $type 返回数据格式 * @return mixed */ @@ -159,11 +159,11 @@ class Response * @access public * @param mixed $msg 提示信息 * @param mixed $data 返回的数据 - * @param mixed $url 跳转的URL地址 - * @param mixed $wait 跳转等待时间 + * @param string $url 跳转的URL地址 + * @param integer $wait 跳转等待时间 * @return mixed */ - public static function success($msg = '', $data = '', $url = '', $wait = 3) + public static function success($msg = '', $data = '', $url = null, $wait = 3) { $code = 1; if (is_numeric($msg)) { @@ -174,7 +174,7 @@ class Response 'code' => $code, 'msg' => $msg, 'data' => $data, - 'url' => $url ?: $_SERVER["HTTP_REFERER"], + 'url' => is_null($url) ? $_SERVER["HTTP_REFERER"] : $url, 'wait' => $wait, ]; @@ -192,11 +192,11 @@ class Response * @access public * @param mixed $msg 提示信息 * @param mixed $data 返回的数据 - * @param mixed $url 跳转的URL地址 - * @param mixed $wait 跳转等待时间 + * @param string $url 跳转的URL地址 + * @param integer $wait 跳转等待时间 * @return mixed */ - public static function error($msg = '', $data = '', $url = '', $wait = 3) + public static function error($msg = '', $data = '', $url = null, $wait = 3) { $code = 0; if (is_numeric($msg)) { @@ -207,7 +207,7 @@ class Response 'code' => $code, 'msg' => $msg, 'data' => $data, - 'url' => $url ?: 'javascript:history.back(-1);', + 'url' => is_null($url) ? 'javascript:history.back(-1);' : $url, 'wait' => $wait, ]; diff --git a/library/traits/controller/Jump.php b/library/traits/controller/Jump.php index 796a8ce4..5e83493e 100644 --- a/library/traits/controller/Jump.php +++ b/library/traits/controller/Jump.php @@ -22,12 +22,12 @@ trait Jump * 操作错误跳转的快捷方法 * @access public * @param mixed $msg 提示信息 - * @param mixed $url 跳转的URL地址 + * @param string $url 跳转的URL地址 * @param mixed $data 返回的数据 - * @param mixed $wait 跳转等待时间 + * @param integer $wait 跳转等待时间 * @return mixed */ - public function error($msg = '', $url = '', $data = '', $wait = 3) + public function error($msg = '', $url = null, $data = '', $wait = 3) { return Response::error($msg, $data, $url, $wait); } @@ -36,12 +36,12 @@ trait Jump * 操作成功跳转的快捷方法 * @access public * @param mixed $msg 提示信息 - * @param mixed $url 跳转的URL地址 + * @param string $url 跳转的URL地址 * @param mixed $data 返回的数据 - * @param mixed $wait 跳转等待时间 + * @param integer $wait 跳转等待时间 * @return mixed */ - public function success($msg = '', $url = '', $data = '', $wait = 3) + public function success($msg = '', $url = null, $data = '', $wait = 3) { return Response::success($msg, $data, $url, $wait); }