Zend Framework, what $this->_forward is doing

前端 未结 5 1915
盖世英雄少女心
盖世英雄少女心 2020-12-14 02:37

I would like someone to explain me what _forward is exactly doing, I cannot see if _forward is also rendering the attached view to the action or just executing the action. <

5条回答
  •  时光说笑
    2020-12-14 02:58

    My experience with Zend is limited and I hope I'm not showing you something you've already seen but according to the docs (12.7.6. Utility Methods):

    _forward($action, $controller = null, $module = null, array $params = null): perform another action. If called in preDispatch(), the currently requested action will be skipped in favor of the new one. Otherwise, after the current action is processed, the action requested in _forward() will be executed.

    So it sounds like the context of when it's called matters. In the latter case it will first execute the action from which it's been called then execute the forwarded action. The exception is when it's being called from the preDispatch handler

提交回复
热议问题