mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
增加APP_ROUTE_ON 和 APP_ROUTE_MUST常量 便于不同的入口文件关闭路由和关闭强制路由模式
This commit is contained in:
2
base.php
2
base.php
@@ -43,6 +43,8 @@ defined('ENV_PREFIX') or define('ENV_PREFIX', 'T_'); // 环境变量的配置前
|
|||||||
defined('IS_API') or define('IS_API', false); // 是否API接口
|
defined('IS_API') or define('IS_API', false); // 是否API接口
|
||||||
defined('APP_AUTO_BUILD') or define('APP_AUTO_BUILD', false); // 是否自动生成应用模块
|
defined('APP_AUTO_BUILD') or define('APP_AUTO_BUILD', false); // 是否自动生成应用模块
|
||||||
defined('APP_AUTO_RUN') or define('APP_AUTO_RUN', 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');
|
defined('APP_MODE') or define('APP_MODE', function_exists('saeAutoLoader') ? 'sae' : 'common');
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ class App
|
|||||||
$depr = $config['pathinfo_depr'];
|
$depr = $config['pathinfo_depr'];
|
||||||
$result = false;
|
$result = false;
|
||||||
// 路由检测
|
// 路由检测
|
||||||
if (!empty($config['url_route_on'])) {
|
if (APP_ROUTE_ON && !empty($config['url_route_on'])) {
|
||||||
// 开启路由
|
// 开启路由
|
||||||
if (!empty($config['route'])) {
|
if (!empty($config['route'])) {
|
||||||
// 注册路由定义文件
|
// 注册路由定义文件
|
||||||
@@ -364,7 +364,7 @@ class App
|
|||||||
}
|
}
|
||||||
// 路由检测(根据路由定义返回不同的URL调度)
|
// 路由检测(根据路由定义返回不同的URL调度)
|
||||||
$result = Route::check($_SERVER['PATH_INFO'], $depr, !IS_CLI ? $config['url_domain_deploy'] : false);
|
$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 ');
|
throw new Exception('route not define ');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user