Home >Backend Development >PHP Tutorial >In-depth understanding of ZF distribution cycle (how Dispatcher works)

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

WBOY
WBOYOriginal
2016-07-25 09:10:231008browse
  1. public function fooAction()

  2. {
  3. // forward to another action in the current controller and module:
  4. $this->_forward('bar', null, null, array('baz' => 'bogus'));
  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' => 'bogus'));
  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' => 'bogus'));
  17. }
  18. ?>

Copy code

Summary: Dispatcher is an important component of ZF's implementation of MVC Partly, understanding the functions of Dipatcher is very important for us to better apply ZF or other frameworks. You can think of allocation as a process that performs the corresponding behavior after routing, and then returns the response object.



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn