mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 15:02:47 +08:00
路由检测增加行为支持
This commit is contained in:
@@ -261,10 +261,13 @@ class Route
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 自定义检测
|
// 自定义检测
|
||||||
if (!empty($option['callback']) && is_callable($option['callback'])) {
|
if (!empty($option['callback']) && is_callable($option['callback']) && false === call_user_func($option['callback'])) {
|
||||||
if (false === call_user_func($option['callback'])) {
|
continue;
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
// 行为检测
|
||||||
|
if (!empty($option['behavior']) && false === \think\hook::exec($option['behavior'])) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($val['routes'])) {
|
if (!empty($val['routes'])) {
|
||||||
@@ -311,7 +314,7 @@ class Route
|
|||||||
$rule = array_shift($val);
|
$rule = array_shift($val);
|
||||||
}
|
}
|
||||||
// 单项路由
|
// 单项路由
|
||||||
$route = !empty($val['route'])?$val['route']:'';
|
$route = !empty($val['route']) ? $val['route'] : '';
|
||||||
if (0 === strpos($rule, '/') && preg_match($rule, $url, $matches)) {
|
if (0 === strpos($rule, '/') && preg_match($rule, $url, $matches)) {
|
||||||
return self::checkRegex($route, $url, $matches);
|
return self::checkRegex($route, $url, $matches);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user