From f865efec6530159948c672d080c1465d7c0e689d Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 17 Aug 2016 11:55:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BRequest=E7=B1=BB=E7=9A=84isAj?= =?UTF-8?q?ax=E5=92=8CisPjax=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Request.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/library/think/Request.php b/library/think/Request.php index 4449b97f..bc4386bc 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -1169,7 +1169,8 @@ class Request */ public function isAjax() { - return (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') ? true : false; + $value = $this->server('HTTP_X_REQUESTED_WITH'); + return (!is_null($value) && strtolower($vlaue) == 'xmlhttprequest') ? true : false; } /** @@ -1179,7 +1180,7 @@ class Request */ public function isPjax() { - return (isset($_SERVER['HTTP_X_PJAX']) && $_SERVER['HTTP_X_PJAX']) ? true : false; + return !is_null($this->server('HTTP_X_PJAX')) ? true : false; } /**