优先执行带有函数名开头的回调方法再执行通用回调方法

This commit is contained in:
不忘初心 2020-08-28 16:52:31 +08:00
parent e757ba1ec9
commit bbf4d5832f

View File

@ -177,7 +177,7 @@ abstract class Controller extends \stdClass
public function callback($name, &$one = [], &$two = [])
{
if (is_callable($name)) return call_user_func($name, $this, $one, $two);
foreach ([$name, "_{$this->app->request->action()}{$name}"] as $method) {
foreach (["_{$this->app->request->action()}{$name}", $name] as $method) {
if (method_exists($this, $method) && false === $this->$method($one, $two)) {
return false;
}