mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 15:02:47 +08:00
验证器类支持公共目录定义 修正Route类单一模块下面GET变量获取错误的BUG
This commit is contained in:
@@ -371,12 +371,15 @@ class Loader
|
|||||||
}
|
}
|
||||||
$class = self::parseClass($module, $layer, $name);
|
$class = self::parseClass($module, $layer, $name);
|
||||||
if (class_exists($class)) {
|
if (class_exists($class)) {
|
||||||
$validate = new $class;
|
$validate = new $class;
|
||||||
$_instance[$name . $layer] = $validate;
|
|
||||||
return $validate;
|
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('class [ ' . $class . ' ] not exists', 10001);
|
$class = str_replace('\\' . $module . '\\', '\\' . COMMON_MODULE . '\\', $class);
|
||||||
|
if (class_exists($class)) {
|
||||||
|
$validate = new $class;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
$_instance[$name . $layer] = $validate;
|
||||||
|
return $validate;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -553,11 +553,11 @@ class Route
|
|||||||
if (false !== strpos($url, '?')) {
|
if (false !== strpos($url, '?')) {
|
||||||
// [模块/控制器/操作?]参数1=值1&参数2=值2...
|
// [模块/控制器/操作?]参数1=值1&参数2=值2...
|
||||||
$info = parse_url($url);
|
$info = parse_url($url);
|
||||||
$path = explode('/', $info['path'], 4);
|
$path = explode('/', $info['path'], APP_MULTI_MODULE ? 4 : 3);
|
||||||
parse_str($info['query'], $var);
|
parse_str($info['query'], $var);
|
||||||
} elseif (strpos($url, '/')) {
|
} elseif (strpos($url, '/')) {
|
||||||
// [模块/控制器/操作]
|
// [模块/控制器/操作]
|
||||||
$path = explode('/', $url, 4);
|
$path = explode('/', $url, APP_MULTI_MODULE ? 4 : 3);
|
||||||
} elseif (false !== strpos($url, '=')) {
|
} elseif (false !== strpos($url, '=')) {
|
||||||
// 参数1=值1&参数2=值2...
|
// 参数1=值1&参数2=值2...
|
||||||
parse_str($url, $var);
|
parse_str($url, $var);
|
||||||
@@ -567,7 +567,7 @@ class Route
|
|||||||
$route = [null, null, null];
|
$route = [null, null, null];
|
||||||
if (isset($path)) {
|
if (isset($path)) {
|
||||||
// 解析path额外的参数
|
// 解析path额外的参数
|
||||||
if (!empty($path[3])) {
|
if (!empty($path[APP_MULTI_MODULE ? 3 : 2])) {
|
||||||
preg_replace_callback('/([^\/]+)\/([^\/]+)/', function ($match) use (&$var) {
|
preg_replace_callback('/([^\/]+)\/([^\/]+)/', function ($match) use (&$var) {
|
||||||
$var[strtolower($match[1])] = strip_tags($match[2]);
|
$var[strtolower($match[1])] = strip_tags($match[2]);
|
||||||
}, array_pop($path));
|
}, array_pop($path));
|
||||||
|
|||||||
Reference in New Issue
Block a user