mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
改进控制器方法的参数 支持使用Request对象 自动传入当前请求对象
This commit is contained in:
@@ -194,7 +194,9 @@ class App
|
||||
$params = $reflect->getParameters();
|
||||
foreach ($params as $param) {
|
||||
$name = $param->getName();
|
||||
if (1 == $type && !empty($vars)) {
|
||||
if ('think\Request' == $param->getClass()->name) {
|
||||
$args[] = Request::instance();
|
||||
} elseif (1 == $type && !empty($vars)) {
|
||||
$args[] = array_shift($vars);
|
||||
} elseif (0 == $type && isset($vars[$name])) {
|
||||
$args[] = $vars[$name];
|
||||
|
||||
@@ -342,7 +342,7 @@ class Input
|
||||
// TODO 其他安全过滤
|
||||
|
||||
// 过滤查询特殊字符
|
||||
if (preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i', $value)) {
|
||||
if (is_string($value) && preg_match('/^(EXP|NEQ|GT|EGT|LT|ELT|OR|XOR|LIKE|NOTLIKE|NOT BETWEEN|NOTBETWEEN|BETWEEN|NOTIN|NOT IN|IN)$/i', $value)) {
|
||||
$value .= ' ';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ class Route
|
||||
private static $rest = [
|
||||
'index' => ['GET', '', 'index'],
|
||||
'create' => ['GET', '/create', 'create'],
|
||||
'read' => ['GET', '/:id', 'read'],
|
||||
'edit' => ['GET', '/:id/edit', 'edit'],
|
||||
'read' => ['GET', '/:id', 'read'],
|
||||
'save' => ['POST', '', 'save'],
|
||||
'update' => ['PUT', '/:id', 'update'],
|
||||
'delete' => ['DELETE', '/:id', 'delete'],
|
||||
|
||||
Reference in New Issue
Block a user