mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进Route类的match方法
This commit is contained in:
@@ -1112,11 +1112,15 @@ class Route
|
||||
|
||||
if (0 === strpos($val, '[:')) {
|
||||
// 可选参数
|
||||
$val = substr($val, 1, -1);
|
||||
$val = substr($val, 1, -1);
|
||||
$optional = true;
|
||||
}
|
||||
if (0 === strpos($val, ':')) {
|
||||
// URL变量
|
||||
$name = substr($val, 1);
|
||||
if (!isset($optional) && !isset($m1[$key])) {
|
||||
return false;
|
||||
}
|
||||
if (isset($m1[$key]) && isset($pattern[$name]) && !preg_match('/^' . $pattern[$name] . '$/', $m1[$key])) {
|
||||
// 检查变量规则
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user