Yaf_Dispatcher::getResponse

Get the response object

説明

public Yaf_Response_Abstractnull Yaf_Dispatcher::getResponse()

Retrieve the Yaf_Response_Abstract instance used by the dispatcher.

パラメータ

この関数にはパラメータはありません。

戻り値

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

例

例1 Yaf_Dispatcher::getResponse example

<?php
class CharsetPlugin extends Yaf_Plugin_Abstract
{
    public function preDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
    {
        // Same response object as the one held by the dispatcher
        Yaf_Dispatcher::getInstance()->getResponse()->setHeader(
            "Content-Type", "text/html; charset=utf-8"
        );
    }
}
?>

参考

  • Yaf_Dispatcher::setResponse
  • Yaf_Response_Abstract