mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
Route类增加setOption和getOption方法 用于记录当前路由执行过程中的参数信息
This commit is contained in:
@@ -69,6 +69,8 @@ class Route
|
||||
private static $domainRule;
|
||||
// 当前域名
|
||||
private static $domain;
|
||||
// 当前路由执行过程中的参数
|
||||
private static $option = [];
|
||||
|
||||
/**
|
||||
* 注册变量规则
|
||||
@@ -341,6 +343,27 @@ class Route
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前执行的参数信息
|
||||
* @access public
|
||||
* @param array $options 参数信息
|
||||
* @return mixed
|
||||
*/
|
||||
protected static function setOption($options = [])
|
||||
{
|
||||
self::$option[] = $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前执行的所有参数信息
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public static function getOption()
|
||||
{
|
||||
return self::$option;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前的分组信息
|
||||
* @access public
|
||||
@@ -898,7 +921,7 @@ class Route
|
||||
if (is_string($str) && $str && 0 !== strpos(str_replace('|', '/', $url), $str)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
self::setOption($option);
|
||||
$result = self::checkRoute($request, $rule, $url, $depr, $key, $option);
|
||||
if (false !== $result) {
|
||||
return $result;
|
||||
@@ -913,6 +936,8 @@ class Route
|
||||
if ($group) {
|
||||
$rule = $group . ($rule ? '/' . ltrim($rule, '/') : '');
|
||||
}
|
||||
|
||||
self::setOption($option);
|
||||
if (isset($options['bind_model']) && isset($option['bind_model'])) {
|
||||
$option['bind_model'] = array_merge($options['bind_model'], $option['bind_model']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user