增加路由开关url_route_on

路由参数改为url_route_rules
This commit is contained in:
thinkphp
2015-11-22 21:45:25 +08:00
parent 6c08b6cfe1
commit 2f6963e8ea

View File

@@ -254,12 +254,15 @@ class App
throw new Exception('URL_SUFFIX_DENY');
}
// 路由检测
Route::register($config['routes']);
Route::check($_SERVER['PATH_INFO'], $config['pathinfo_depr']);
if (!empty($config['url_route_on'])) {
// 开启路由 则检测路由配置 并默认读取 url_route_rules 参数
Route::register($config['url_route_rules']);
Route::check($_SERVER['PATH_INFO'], $config['pathinfo_depr']);
}
// 获取URL中的模块名
if ($config['require_module'] && !isset($_GET[VAR_MODULE])) {
$paths = explode($config['pathinfo_depr'], __INFO__, 2);
$paths = explode($config['pathinfo_depr'], __INFO__, 2);
$_GET[VAR_MODULE] = array_shift($paths);
$_SERVER['PATH_INFO'] = implode('/', $paths);
}