From e3db097287c5e022b4c53982db154cb3166807cc Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 2 Nov 2016 16:53:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E7=9A=84ajax=20pjax=20https?= =?UTF-8?q?=20=E6=A3=80=E6=B5=8B=E5=8F=82=E6=95=B0=E6=94=AF=E6=8C=81=20?= =?UTF-8?q?=E9=9D=9E=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index 6e5bd27d..63cbe9c4 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -1122,14 +1122,16 @@ class Route */ private static function checkOption($option, $request) { - // 请求类型检测 if ((isset($option['method']) && is_string($option['method']) && false === stripos($option['method'], $request->method())) - || (!empty($option['ajax']) && !$request->isAjax()) // Ajax检测 - || (!empty($option['pjax']) && !$request->isPjax()) // Pjax检测 + || (isset($option['ajax']) && $option['ajax'] && !$request->isAjax()) // Ajax检测 + || (isset($option['ajax']) && !$option['ajax'] && $request->isAjax()) // 非Ajax检测 + || (isset($option['pjax']) && $option['pjax'] && !$request->isPjax()) // Pjax检测 + || (isset($option['pjax']) && !$option['pjax'] && $request->isPjax()) // 非Pjax检测 || (isset($option['ext']) && false === stripos($option['ext'], $request->ext())) // 伪静态后缀检测 || (isset($option['deny_ext']) && false !== stripos($option['deny_ext'], $request->ext())) || (isset($option['domain']) && !in_array($option['domain'], [$_SERVER['HTTP_HOST'], self::$subDomain])) // 域名检测 - || (!empty($option['https']) && !$request->isSsl()) // https检测 + || (isset($option['https']) && $option['https'] && !$request->isSsl()) // https检测 + || (isset($option['https']) && !$option['https'] && $request->isSsl()) // https检测 || (!empty($option['before_behavior']) && false === Hook::exec($option['before_behavior'])) // 行为检测 || (!empty($option['callback']) && is_callable($option['callback']) && false === call_user_func($option['callback'])) // 自定义检测 ) {