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 '); }