多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# Abstract class Phalcon\\Dispatcher # Abstract class **Phalcon\\Dispatcher** *implements*[*Phalcon\\DispatcherInterface*](#), `Phalcon\Di\InjectionAwareInterface`, [*Phalcon\\Events\\EventsAwareInterface*](#) This is the base class for Phalcon\\Mvc\\Dispatcher and Phalcon\\CLI\\Dispatcher. This class can't be instantiated directly, you can use it to create your own dispatchers ### Constants *integer***EXCEPTION\_NO\_DI** *integer***EXCEPTION\_CYCLIC\_ROUTING** *integer***EXCEPTION\_HANDLER\_NOT\_FOUND** *integer***EXCEPTION\_INVALID\_HANDLER** *integer***EXCEPTION\_INVALID\_PARAMS** *integer***EXCEPTION\_ACTION\_NOT\_FOUND** ### Methods public **\_\_construct** () Phalcon\\Dispatcher constructor public **setDI** (*unknown* $dependencyInjector) Sets the dependency injector public **getDI** () Returns the internal dependency injector public **setEventsManager** (*unknown* $eventsManager) Sets the events manager public **getEventsManager** () Returns the internal event manager public **setActionSuffix** (*unknown* $actionSuffix) Sets the default action suffix public **setModuleName** (*unknown* $moduleName) Sets the module where the controller is (only informative) public **getModuleName** () Gets the module where the controller class is public **setNamespaceName** (*unknown* $namespaceName) Sets the namespace where the controller class is public **getNamespaceName** () Gets a namespace to be prepended to the current handler name public **setDefaultNamespace** (*unknown* $namespaceName) Sets the default namespace public **getDefaultNamespace** () Returns the default namespace public **setDefaultAction** (*unknown* $actionName) Sets the default action name public **setActionName** (*unknown* $actionName) Sets the action name to be dispatched public **getActionName** () Gets the latest dispatched action name public **setParams** (*array* $params) Sets action params to be dispatched public **getParams** () Gets action params public **setParam** (*mixed* $param, *mixed* $value) Set a param by its name or numeric index public *mixed***getParam** (*mixed* $param, \[*string|array* $filters\], \[*mixed* $defaultValue\]) Gets a param by its name or numeric index public **getActiveMethod** () Returns the current method to be/executed in the dispatcher public **isFinished** () Checks if the dispatch loop is finished or has more pendent controllers/tasks to dispatch public **setReturnedValue** (*mixed* $value) Sets the latest returned value by an action manually public *mixed***getReturnedValue** () Returns value returned by the lastest dispatched action public *object***dispatch** () Dispatches a handle action taking into account the routing parameters public **forward** (*array* $forward) Forwards the execution flow to another controller/action Dispatchers are unique per module. Forwarding between modules is not allowed ``` <pre class="calibre14">``` <?php $this->dispatcher->forward(array("controller" => "posts", "action" => "index")); ``` ``` public **wasForwarded** () Check if the current executed action was forwarded by another one public **getHandlerClass** () Possible class name that will be located to dispatch the request protected **\_resolveEmptyProperties** () Set empty properties to their defaults (where defaults are available) | - [索引](# "总目录") - [下一页](# "Class Phalcon\Escaper") | - [上一页](# "Class Phalcon\Debug\Exception") | - [API Indice](#) »