路由条件增加ajax和pjax

This commit is contained in:
thinkphp
2016-10-23 23:40:36 +08:00
parent 8f6cee67ed
commit aca32d1da3
2 changed files with 4 additions and 2 deletions

View File

@@ -9,7 +9,7 @@
// | Author: liu21st <liu21st@gmail.com> // | Author: liu21st <liu21st@gmail.com>
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
define('THINK_VERSION', '5.0.2dev'); define('THINK_VERSION', '5.0.2');
define('THINK_START_TIME', microtime(true)); define('THINK_START_TIME', microtime(true));
define('THINK_START_MEM', memory_get_usage()); define('THINK_START_MEM', memory_get_usage());
define('EXT', '.php'); define('EXT', '.php');

View File

@@ -1093,7 +1093,9 @@ class Route
{ {
// 请求类型检测 // 请求类型检测
if ((isset($option['method']) && is_string($option['method']) && false === stripos($option['method'], $request->method())) if ((isset($option['method']) && is_string($option['method']) && false === stripos($option['method'], $request->method()))
|| (isset($option['ext']) && false === stripos($option['ext'], $request->ext())) // 伪静态后缀检测 || (!empty($option['ajax']) && !$request->isAjax()) // Ajax检测
|| (!empty($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['deny_ext']) && false !== stripos($option['deny_ext'], $request->ext()))
|| (isset($option['domain']) && !in_array($option['domain'], [$_SERVER['HTTP_HOST'], self::$subDomain])) // 域名检测 || (isset($option['domain']) && !in_array($option['domain'], [$_SERVER['HTTP_HOST'], self::$subDomain])) // 域名检测
|| (!empty($option['https']) && !$request->isSsl()) // https检测 || (!empty($option['https']) && !$request->isSsl()) // https检测