mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 15:42:48 +08:00
改进App类的空操作方法调用
This commit is contained in:
@@ -377,12 +377,14 @@ class App
|
|||||||
// 获取当前操作名
|
// 获取当前操作名
|
||||||
$action = $actionName . $config['action_suffix'];
|
$action = $actionName . $config['action_suffix'];
|
||||||
|
|
||||||
|
$vars = [];
|
||||||
if (is_callable([$instance, $action])) {
|
if (is_callable([$instance, $action])) {
|
||||||
// 执行操作方法
|
// 执行操作方法
|
||||||
$call = [$instance, $action];
|
$call = [$instance, $action];
|
||||||
} elseif (is_callable([$instance, '_empty'])) {
|
} elseif (is_callable([$instance, '_empty'])) {
|
||||||
// 空操作
|
// 空操作
|
||||||
$call = [$instance, '_empty'];
|
$call = [$instance, '_empty'];
|
||||||
|
$vars = [$action];
|
||||||
} else {
|
} else {
|
||||||
// 操作不存在
|
// 操作不存在
|
||||||
throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()');
|
throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()');
|
||||||
@@ -390,7 +392,7 @@ class App
|
|||||||
|
|
||||||
Hook::listen('action_begin', $call);
|
Hook::listen('action_begin', $call);
|
||||||
|
|
||||||
return self::invokeMethod($call);
|
return self::invokeMethod($call, $vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user