This article mainly introduces the use of Zend Framework dispatcher, and analyzes the function, definition and simple use method of Zend Framework dispatcher in combination with instance form, and the friends who need can refer to the following
The examples in this article describe the Zend Framework dispatcher usage. Share to everyone for your reference, as follows:
Distribution is the acquisition of the request object, extracting the module name, controller name, action name, and optional parameters, and then instantiating the controller and invoking the entire process of the action.
If the module, controller, or action is not found, the default value is used.
The Zend_controller_dispatcher_standard class specifies that the default value for each controller and action is index, and the default value for the module is defaults.
This class allows developers to change the default value setting through the Setdefaultcontroller () method, the SetDefaultAction () method, and the Setdefaultmodule () method.
_forward ()
function: Call this method in any action, and pass in the action, controller, module and optional parameters, you can enter the new action.
Case:
<?phppublic function Fooaction () { //define action //Go to the current controller and other actions in the module $this->_forward (' Bar ', Null,null, Array (' baz ' = ' bogus '));//first parameter, table action, second argument, table controller, third parameter indicates module}public function baraction () {// define action // Go to the action of the other controller of the current module, foocontroller::bazaction () $this->_forward (' Baz ', ' foo ', Null,array (' baz ' = ' bogus '));} Public Function bazaction () { //go to other controllers, actions in other modules, foo_barcontroller::bazaction () $this->_forward (' Baz ', ' Bar ', ' foo ', Array (' baz ' = ' bogus '));}
The above is the whole content of this article, thank you for reading, more relevant content please pay attention to topic.alibabacloud.com!