think\Controller::beforeAction PHP Метод

beforeAction() защищенный Метод

前置操作
protected beforeAction ( string $method, array $options = [] )
$method string 前置操作方法名
$options array 调用参数 ['only'=>[...]] 或者['except'=>[...]]
    protected function beforeAction($method, $options = [])
    {
        if (isset($options['only'])) {
            if (is_string($options['only'])) {
                $options['only'] = explode(',', $options['only']);
            }
            if (!in_array($this->request->action(), $options['only'])) {
                return;
            }
        } elseif (isset($options['except'])) {
            if (is_string($options['except'])) {
                $options['except'] = explode(',', $options['except']);
            }
            if (in_array($this->request->action(), $options['except'])) {
                return;
            }
        }
        call_user_func([$this, $method]);
    }