增加route_complete_match配置参数设置全局路由规则定义是否采用完整匹配 可以由路由规则的参数complete_match 进行覆盖

This commit is contained in:
thinkphp
2016-08-22 16:42:35 +08:00
parent 714eb8f1b7
commit 9c349c86ed

View File

@@ -284,10 +284,14 @@ class Route
} elseif (is_string($route)) {
$name = $route;
}
if ('$' == substr($rule, -1, 1)) {
// 是否完整匹配
$option['complete_match'] = true;
$rule = substr($rule, 0, -1);
if (!isset($option['complete_match'])) {
if (Config::get('route_complete_match')) {
$option['complete_match'] = true;
} elseif ('$' == substr($rule, -1, 1)) {
// 是否完整匹配
$option['complete_match'] = true;
$rule = substr($rule, 0, -1);
}
}
if ('/' != $rule) {
$rule = trim($rule, '/');