Zend Framework distributor usage example, zendframework

Source: Internet
Author: User
Tags zend framework

Zend Framework distributor usage example, zendframework

This example describes the Zend Framework distributor usage. We will share this with you for your reference. The details are as follows:

Distribution is the process of obtaining the request object, extracting the module name, controller name, action name, and optional parameters, instantiating the controller, and calling 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 of each controller and action is index, and that of the module is default.

This class allows developers to change the default value through the setdefacontroller controller () method, setDefaultAction () method, and setdefamodule module () method.

_ Forward ()

Function:Call this method in any action, and input the action, controller, module, and optional parameters to 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' => 'bogg'); // The first parameter, table action; the second parameter, table Controller; the third parameter, indicating the module} public function barAction () {// define the action // switch to the action of another controller of the current module. FooController: bazAction () $ this-> _ forward ('baz', 'foo ', null, array ('baz' => 'bogg');} public function bazAction () {// switch to other controllers and actions in other modules, Foo_BarController: bazAction () $ this-> _ forward ('baz', 'bar', 'foo', array ('baz' => 'bogg '));}

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.