src/base/Application.php
public function run()
    {
        if (YII_ENABLE_ERROR_HANDLER) {
            $this->get('errorHandler')->register();
        }

        try {
            $this->state = self::STATE_BEFORE_REQUEST;
            $this->trigger(RequestEvent::BEFORE);

            $this->state = self::STATE_HANDLING_REQUEST;
            $this->response = $this->handleRequest($this->getRequest());

            $this->state = self::STATE_AFTER_REQUEST;
            $this->trigger(RequestEvent::AFTER);

            $this->state = self::STATE_SENDING_RESPONSE;
            $this->response->send();

            $this->state = self::STATE_END;

            return $this->response->exitStatus;
        } catch (ExitException $e) {
            $this->end($e->statusCode, $this->response ?? null);
            return $e->statusCode;
        }
    }
public function run()
    {
        if (YII_ENABLE_ERROR_HANDLER) {
            $this->get('errorHandler')->register();
        }

        try {
            $this->state = self::STATE_BEFORE_REQUEST;
            $this->trigger(RequestEvent::BEFORE);

            $this->state = self::STATE_HANDLING_REQUEST;
            $this->response = $this->handleRequest($this->getRequest());

            $this->state = self::STATE_AFTER_REQUEST;
            $this->trigger(RequestEvent::AFTER);

            $this->state = self::STATE_SENDING_RESPONSE;
            $this->response->send();

            $this->state = self::STATE_END;

            return $this->response->exitStatus;
        } catch (ExitException $e) {
            $this->end($e->statusCode, $this->response ?? null);
            return $e->statusCode;
        }
    }
public function run ( ) { if ( YII_ENABLE_ERROR_HANDLER ) { $ this -> get ( 'errorHandler' ) -> register ( ) ; } try { $ this -> state = self :: STATE_BEFORE_REQUEST ; $ this -> trigger ( RequestEvent :: BEFORE ) ; $ this -> state = self :: STATE_HANDLING_REQUEST ; $ this -> response = $ this -> handleRequest ( $ this -> getRequest ( ) ) ; $ this -> state = self :: STATE_AFTER_REQUEST ; $ this -> trigger ( RequestEvent :: AFTER ) ; $ this -> state = self :: STATE_SENDING_RESPONSE ; $ this -> response -> send ( ) ; $ this -> state = self :: STATE_END ; return $ this -> response -> exitStatus ; } catch ( ExitException $ e ) { $ this -> end ( $ e -> statusCode , $ this -> response ?? null ) ; return $ e -> statusCode ; } }
Runs the application.
This is the main entrance of an application.
@return int the exit status (0 means normal, non-zero values mean abnormal)
Runs the application . This is the main entrance of an application .