Usage of the Zend framework dispatcher

Source: Internet
Author: User
Tags zend framework
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.