mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
改进Route类可选参数的完整匹配检测
This commit is contained in:
@@ -910,7 +910,7 @@ class Route
|
||||
if ($len1 >= $len2 || strpos($rule, '[')) {
|
||||
if ('$' == substr($rule, -1, 1)) {
|
||||
// 完整匹配
|
||||
if (!$merge && $len1 != $len2 && false === strpos($rule, '[')) {
|
||||
if (!$merge && $len1 != $len2 && (false === strpos($rule, '[') || $len1 > $len2 || $len1 < $len2 - substr_count($rule, '['))) {
|
||||
return false;
|
||||
} else {
|
||||
$rule = substr($rule, 0, -1);
|
||||
@@ -924,7 +924,7 @@ class Route
|
||||
if ($option['after_behavior'] instanceof \Closure) {
|
||||
$result = call_user_func_array($option['after_behavior'], [$route]);
|
||||
} else {
|
||||
foreach((array)$option['after_behavior'] as $behavior){
|
||||
foreach ((array) $option['after_behavior'] as $behavior) {
|
||||
$result = Hook::exec($behavior, '', $route);
|
||||
if (!is_null($result)) {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user