改进操作获取

This commit is contained in:
thinkphp
2018-03-26 17:24:20 +08:00
parent e6b7e87586
commit 97de5ec026
4 changed files with 12 additions and 10 deletions

View File

@@ -581,6 +581,13 @@ class App
if (is_callable([$instance, $action])) {
// 执行操作方法
$call = [$instance, $action];
// 严格获取当前操作方法名
$reflect = new \ReflectionMethod($instance, $action);
$methodName = $reflect->getName();
$suffix = $config['action_suffix'];
$actionName = $suffix ? substr($methodName, 0, -strlen($suffix)) : $methodName;
$request->action($actionName);
} elseif (is_callable([$instance, '_empty'])) {
// 空操作
$call = [$instance, '_empty'];