(Yaf >=1.0.0)
Yaf_Dispatcher::getResponse — 获取响应对象
获取 dispatcher 使用的 Yaf_Response_Abstract 实例。
此函数没有参数。
返回 Yaf_Response_Abstract 实例,
如果应用尚未初始化则返回 null。
示例 #1 Yaf_Dispatcher::getResponse() 示例
<?php
class CharsetPlugin extends Yaf_Plugin_Abstract
{
public function preDispatch(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
{
// 与 dispatcher 持有的是同一个响应对象
Yaf_Dispatcher::getInstance()->getResponse()->setHeader(
"Content-Type", "text/html; charset=utf-8"
);
}
}
?>