Yaf_Dispatcher::getResponse
PHP function
Edit on GitHub ✎
(Yaf >=1.0.0)
Get the response object
Description
Yaf_Dispatcher::getResponse(): Yaf_Response_Abstract|null
Retrieve the Yaf_Response_Abstract instance used by the dispatcher.
Parameters Parameters
Return Values
The Yaf_Response_Abstract instance, or null if the application is not initialized.
Examples
Yaf_Dispatcher::getResponse example
php
<?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"
);
}
}
?>See Also
Yaf_Dispatcher::setResponseYaf_Response_Abstract