The examples in this article describe the Zend Framework dispatcher usage. Share to everyone for your reference, specific as follows:
Distribution is the process of obtaining the requested object, extracting the module name, controller name, action name, and optional parameters, and then instantiating the controller and invoking 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 module defaults to default.
This class allows developers to change the default value setting through the Setdefaultcontroller () method, the SetDefaultAction () method, and the Setdefaultmodule () method.
_forward ()
function: Call the method in any action, and pass in the action, controller, module, and optional parameters to enter the new action.
Case:
<?php Public
function fooaction () { //define action
//Go to the current controller and other actions in the module
$this->_forward (' bar ', NULL, Null,array (' Baz ' => ' bogus '))//First argument, table action, second argument, table controller, third parameter represents module
} public
function Baraction () { //
foocontroller::bazaction ()
$this->_forward (' Baz ', ' foo ', Null,array (' Baz '), which defines the action//move to the other controller of the current module. > ' bogus ');
}
Public Function bazaction () {
//go to other controllers, actions in other modules, foo_barcontroller::bazaction ()
$this->_forward (' Baz ', ' Bar ', ' foo ', Array (' Baz ' => ' bogus ');
}
More interested in Zend related content readers can view the site topics: "The introduction of the Zend Framework frame", "PHP Excellent Development Framework Summary", "Yii framework Introduction and common skills Summary", "thinkphp Introductory Course", "PHP object-oriented Programming Program , "Php+mysql Database operation Introduction Tutorial" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design based on the Zend Framework.