且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从 ZF2 中的控制器调用另一个控制器操作的***实践

更新时间:2023-09-10 20:58:40

我会说使用 forward 插件 是 ZF2 的方式.您提出的另一个解决方案听起来非常复杂,可能会让您遇到各种意想不到的 dito 错误问题.

I would say that using the forward plugin is the ZF2 way to do it. This other solution that you propose sounds very complicated and might get you in all sorts of unsuspected trouble with dito bugs.

$this->forward()->dispatch('foo', array('action' => 'process'));

或者是否有合理的论据为什么使用这个 forward 插件不是你想要的?

Or is there a reasonable argument why using this forward plugin is not what you want?

我实际上不明白为什么您不能从 ControllerManager 获取其他控制器.您确定它已注册并且您使用正确的名称来获取它吗?

I actually don't understand why you can't get your other controller from your ControllerManager. Are you sure it is registered and that you use the correct name to get it?