How to use Zend Framework dispenser Zend_Controller_Dispatcher
This article will explain in detail how to use Zend_Controller_Dispatcher, the distributor of Zend Framework. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
The details are as follows:
The concrete realization of the distributor
The Zend_Controller_Dispatcher design of Zend Framework dispenser mainly consists of the following classes and interfaces:
├── Dispatcher
│ ├── Abstract.php
│ ├── Exception.php
│ ├── Interface.php
│ └── Standard.php
Zend_Controller_Dispatcher_Interface
The basic and standard functions provided by the dispenser are defined.
Interface Zend_Controller_Dispatcher_Interface {public function formatControllerName ($unformatted); public function formatModuleName ($unformatted); public function formatActionName ($unformatted); public function isDispatchable (Zend_Controller_Request_Abstract $request); public function setParam ($name, $value); public function setParams (array $params); public function getParam ($name); public function getParams (); public function clearParams ($name = null); public function setResponse (Zend_Controller_Response_Abstract $response = null); public function getResponse (); public function addControllerDirectory ($path, $args = null) Public function setControllerDirectory ($path); public function getControllerDirectory (); public function dispatch (Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response); public function isValidModule ($module); public function getDefaultModule (); public function getDefaultControllerName (); public function getDefaultAction ();}
Zend_Controller_Dispatcher_Abstract
Implements the Zend_Controller_Dispatcher_Interface interface, which provides an abstract parent class of basic and standard functions provided by the dispatcher.