mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 07:02:47 +08:00
改进域名绑定的参数传入解析
This commit is contained in:
@@ -217,7 +217,6 @@ class Route
|
|||||||
if (!empty($rule)) {
|
if (!empty($rule)) {
|
||||||
// 子域名部署规则
|
// 子域名部署规则
|
||||||
// '子域名'=>'模块[/控制器/操作]'
|
// '子域名'=>'模块[/控制器/操作]'
|
||||||
// '子域名'=>['模块[/控制器/操作]','var1=a&var2=b&var3=*'];
|
|
||||||
// '子域名'=>'模块[/控制器/操作]?var1=a&var2=b&var3=*';
|
// '子域名'=>'模块[/控制器/操作]?var1=a&var2=b&var3=*';
|
||||||
if ($rule instanceof \Closure) {
|
if ($rule instanceof \Closure) {
|
||||||
// 执行闭包
|
// 执行闭包
|
||||||
@@ -225,30 +224,24 @@ class Route
|
|||||||
self::$bind = $reflect->invokeArgs([]);
|
self::$bind = $reflect->invokeArgs([]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is_array($rule)) {
|
|
||||||
$result = $rule[0];
|
if (strpos($rule, '?')) {
|
||||||
if (isset($rule[1])) {
|
// 传入其它参数
|
||||||
// 传入参数
|
$array = parse_url($rule);
|
||||||
parse_str($rule[1], $params);
|
$result = $array['path'];
|
||||||
if (isset($panDomain)) {
|
parse_str($array['query'], $params);
|
||||||
$pos = array_search('*', $params);
|
if (isset($panDomain)) {
|
||||||
if (false !== $pos) {
|
$pos = array_search('*', $params);
|
||||||
// 泛域名作为参数
|
if (false !== $pos) {
|
||||||
$params[$pos] = $panDomain;
|
// 泛域名作为参数
|
||||||
}
|
$params[$pos] = $panDomain;
|
||||||
}
|
}
|
||||||
$_GET = array_merge($_GET, $params);
|
|
||||||
}
|
}
|
||||||
|
$_GET = array_merge($_GET, $params);
|
||||||
} else {
|
} else {
|
||||||
if (strpos($rule, '?')) {
|
$result = $rule;
|
||||||
$result = strstr($rule, '?', true);
|
|
||||||
$query = strstr($rule, '?');
|
|
||||||
parse_str(substr($query, 1), $params);
|
|
||||||
$_GET = array_merge($_GET, $params);
|
|
||||||
}else{
|
|
||||||
$result = $rule;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 === strpos($result, '\\')) {
|
if (0 === strpos($result, '\\')) {
|
||||||
// 绑定到命名空间 例如 \app\index\behavior
|
// 绑定到命名空间 例如 \app\index\behavior
|
||||||
self::$bind = ['type' => 'namespace', 'namespace' => $result];
|
self::$bind = ['type' => 'namespace', 'namespace' => $result];
|
||||||
|
|||||||
Reference in New Issue
Block a user