mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 15:42:48 +08:00
改进路由规则定义的变量获取
This commit is contained in:
@@ -609,10 +609,18 @@ class Route
|
|||||||
$val = str_replace('<' . $name . '>', '(' . $pattern[$name] . ')', $val);
|
$val = str_replace('<' . $name . '>', '(' . $pattern[$name] . ')', $val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!preg_match('/^' . $val . '$/', $m1[$key])) {
|
if (preg_match('/^' . $val . '$/', $m1[$key], $match)) {
|
||||||
|
array_shift($match);
|
||||||
|
foreach ($matches[1] as $i => $name) {
|
||||||
|
if (strpos($name, '?')) {
|
||||||
|
$name = substr($name, 0, -1);
|
||||||
|
}
|
||||||
|
$var[$name] = $match[$i];
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === strpos($val, '[:')) {
|
if (0 === strpos($val, '[:')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user