Yaf_Dispatcher::getRequest
PHP Manual
PHP Manual»Yaf_Dispatcher»Yaf_Dispatcher::getRequest

Yaf_Dispatcher::getRequest

(Yaf >=1.0.0)

Yaf_Dispatcher::getRequest — Retrieve the request instance

Опис

public function Yaf_Dispatcher::getRequest(): ?Yaf_Request_Abstract

Retrieve the request object held by the dispatcher.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

The Yaf_Request_Abstract instance, or null if the application is not initialized.

Приклади

Приклад #1 Yaf_Dispatcher::getRequest() example

<?php
class IndexController extends Yaf_Controller_Abstract
{
    public function indexAction()
    {
        $request = Yaf_Dispatcher::getInstance()->getRequest();

        // The dispatcher holds the very same request object that is
        // passed to the controller
        var_dump($request === $this->getRequest());

        return false;
    }
}
?>

Поданий вище приклад виведе щось схоже на:

bool(true)

Прогляньте також

To Top