Yaf_Dispatcher是单例模式运行的, 也就是说自始至终只生成一个Yaf_Dispatcher实例, 因此, 可以把它看成是在分发过程中生成的对象的注册表, 可以从中获取到分发过程中产生的对象.
Yaf_Dispatcher类摘要[php] view plaincopyfinal Yaf_Dispatcher { /* 属性 */ protected $_router ; protected $_view ; protected $_request ; protected $_plugins ; protected static $_instance ; protected $_auto_render ; protected $_return_response ; protected $_instantly_flush ; protected $_default_module ; protected $_default_controller ; protected $_default_action ; /* 方法 */ public Yaf_Dispatcher autoRender ( bool $flag ) public Yaf_Dispatcher catchException ([ bool $flag ] ) private void __clone ( void ) public__construct ( void ) public bool disableView ( void ) public Yaf_Response_Abstract dispatch ( Yaf_Request_Abstract $request ) public Yaf_Dispatcher enableView ( void ) public Yaf_Dispatcher flushInstantly ( bool $flag ) public Yaf_Application getApplication ( void ) public static Yaf_Dispatcher getInstance ( void ) public Yaf_Request_Abstract getRequest ( void ) public Yaf_Router getRouter ( void ) public Yaf_View_Interface initView ( string $templates_dir [, array $options ] ) public Yaf_Dispatcher registerPlugin ( Yaf_Plugin_Abstract $plugin ) public Yaf_Dispatcher returnResponse ( bool $flag ) public Yaf_Dispatcher setDefaultAction ( string $action ) public Yaf_Dispatcher setDefaultController ( string $controller ) public Yaf_Dispatcher setDefaultModule ( string $module ) public Yaf_Dispatcher setErrorHandler ( call $callback , int $error_types ) public Yaf_Dispatcher setRequest ( Yaf_Request_Abstract $request ) public Yaf_Dispatcher setView ( Yaf_View_Interface $view ) private void __sleep ( void ) public Yaf_Dispatcher throwException ([ bool $flag ] ) private void __wakeup ( void ) } Yaf_Dispatcher成员方法列表Yaf_Dispatcher::autoRender — 开启/关闭自动渲染功能 Yaf_Dispatcher::catchException — 开启/关闭自动异常捕获功能 Yaf_Dispatcher::__clone — Yaf_Dispatcher 不能被克隆 Yaf_Dispatcher::__construct — Yaf_Dispatcher 构造函数 Yaf_Dispatcher::disableView — 关闭自动渲染 Yaf_Dispatcher::dispatch — 分发请求 Yaf_Dispatcher::enableView — 开启自动渲染 Yaf_Dispatcher::flushInstantly — 打开关闭自动响应 Yaf_Dispatcher::getApplication — 获取当前的Yaf_Application实例 Yaf_Dispatcher::getInstance — 获取当前的Yaf_Dispatcher实例 Yaf_Dispatcher::getRequest — 获取当前的请求实例 Yaf_Dispatcher::getRouter — 获取路由器 Yaf_Dispatcher::initView — 初始化视图引擎并返回它 Yaf_Dispatcher::registerPlugin — 注册一个插件 Yaf_Dispatcher::returnResponse — The returnResponse purpose Yaf_Dispatcher::setDefaultAction — 设置路由的默认动作 Yaf_Dispatcher::setDefaultController — 设置路由的默认控制器 Yaf_Dispatcher::setDefaultModule — 设置路由的默认模块 Yaf_Dispatcher::setErrorHandler — 设置错误处理函数 Yaf_Dispatcher::setRequest — The setRequest purpose Yaf_Dispatcher::setView — 设置视图引擎 Yaf_Dispatcher::__sleep — Yaf_Dispatcher 不能被序列化 Yaf_Dispatcher::throwException — 开启/关闭异常抛出 Yaf_Dispatcher::__wakeup — Yaf_Dispatcher 不能被反序列化