In-depth understanding of ZF distribution loop (how Dispatcher works)

Source: Internet
Author: User
In-depth understanding of ZF distribution loop (how Dispatcher works)

  1. Public function fooAction ()

  2. {
  3. // Forward to another action in the current controller and module:
  4. $ This-> _ forward ('bar', null, null, array ('Baz' => 'bogg '));
  5. }

  6. Public function barAction ()

  7. {
  8. // Forward to an action in another controller, FooController: bazAction (),
  9. // In the current module:
  10. $ This-> _ forward ('Baz', 'foo', null, array ('Baz' => 'bogg '));
  11. }

  12. Public function bazAction ()

  13. {
  14. // Forward to an action in another controller in another module,
  15. // Foo_BarController: bazAction ():
  16. $ This-> _ forward ('Baz', 'bar', 'foo', array ('Baz' => 'bogg '));
  17. }
  18. ?>

Conclusion: Dispatcher is an important part of ZF's implementation of MVC. Understanding the functions of Dipatcher is of great significance for us to better apply ZF or other frameworks. It can be considered that the allocation function is similar to a process that executes the corresponding behavior after the route, and then returns the response object.

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.