如何 运行 助手的控制器。 Zend 框架 1.12

How to run a controller from a helper. Zend Framework 1.12

我明白这不是真的! 但是告诉我,我怎样才能 运行 其他模块->来自动作助手的控制器? 或者给我其他方式!

我有一个 api 模块,并且需要 运行 来自 helper 的 api 模块和准备好的请求参数。 你对此有什么想法吗?

进入 Action_Helper 我尝试应用此代码:

require_once "../../modules/somemodule/controllers/SomeController.php";
$ctrl = new Somemodule_SomeController($request, $response);
$ctrl->run();

但是报错:

Fatal error:  require_once(): Failed opening required '../../modules/somemodule/controllers/SomeController.php' (include_path='..') in /path/to/helper/action

解决方案

如果我们问另一个问题

How to run a controller from another controller?

我们有答案=)
成为行动助手

$that = $this->getActionController();
$that->forward("someAction", "someController", "someModule", $params);

如果我们问另一个问题

How to run a controller from another controller?

我们有答案=)
成为行动助手

$that = $this->getActionController();
$that->forward("someAction", "someController", "someModule", $params);