How to print out data within function beforeAction? I want to make some verification before each action in a controller, therefore if some condition occurs in beforeAction I should print out data and prevent further execution, for example, JSON: 

```
[
   status: "error",
   msg: "access denied"
]

```

I try to even inner redirect to another controller, but it doesn't work.

```
public function beforeAction($action)
{
    $request = Yii::$app->request;
    if ( ! checkByToken($request->get('token')) && $this->getRoute() != 'web/abonent/token_error') {
        \Yii::$app->runAction('web/abonent/token_error');
        return true;
    }

    return parent::beforeAction($action); // TODO: Change the autogenerated stub
}

```

But maybe there an another concept of doing so. I just need to check the condition before any actions and print our result or let the action execute.