From 5319bbaf5f717b370cab7543cee3f9101c1d4a3a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 17 Feb 2016 21:55:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0APP=5FROUTE=5FON=20=E5=92=8C?= =?UTF-8?q?=20APP=5FROUTE=5FMUST=E5=B8=B8=E9=87=8F=20=E4=BE=BF=E4=BA=8E?= =?UTF-8?q?=E4=B8=8D=E5=90=8C=E7=9A=84=E5=85=A5=E5=8F=A3=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E8=B7=AF=E7=94=B1=E5=92=8C=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=BC=BA=E5=88=B6=E8=B7=AF=E7=94=B1=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base.php | 2 ++ library/think/App.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/base.php b/base.php index 540554f0..b3b1399c 100644 --- a/base.php +++ b/base.php @@ -43,6 +43,8 @@ defined('ENV_PREFIX') or define('ENV_PREFIX', 'T_'); // 环境变量的配置前 defined('IS_API') or define('IS_API', false); // 是否API接口 defined('APP_AUTO_BUILD') or define('APP_AUTO_BUILD', false); // 是否自动生成应用模块 defined('APP_AUTO_RUN') or define('APP_AUTO_RUN', false); // 是否自动运行 +defined('APP_ROUTE_ON') or define('APP_ROUTE_ON', true); // 是否允许路由 +defined('APP_ROUTE_MUST') or define('APP_ROUTE_MUST', true); // 是否严格检查路由 // 应用模式 默认为普通模式 defined('APP_MODE') or define('APP_MODE', function_exists('saeAutoLoader') ? 'sae' : 'common'); diff --git a/library/think/App.php b/library/think/App.php index cb5d3952..82ae8468 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -356,7 +356,7 @@ class App $depr = $config['pathinfo_depr']; $result = false; // 路由检测 - if (!empty($config['url_route_on'])) { + if (APP_ROUTE_ON && !empty($config['url_route_on'])) { // 开启路由 if (!empty($config['route'])) { // 注册路由定义文件 @@ -364,7 +364,7 @@ class App } // 路由检测(根据路由定义返回不同的URL调度) $result = Route::check($_SERVER['PATH_INFO'], $depr, !IS_CLI ? $config['url_domain_deploy'] : false); - if (false === $result && $config['url_route_must']) { + if (APP_ROUTE_MUST && false === $result && $config['url_route_must']) { // 路由无效 throw new Exception('route not define '); }