我是Zend Modular Application的新手。我有一个api控制器,我想从这个控制器调用其他模块。例如,将数据发布到此地址:
http://localhost/api/addTask
我添加了一个自定义路由,将所有请求重定向到api / index
目前,如何通过indexAction调用模块或其他方法?
例如:
function indexAction()
{
$params = $this->getRequets()->getParams();
$controller = $params[0];//I know that there is issues with this line but keep going...
//module name is addTask
//call to module or controller addTask
}
先谢谢
答案 0 :(得分:1)
您可以使用_forward()
从控制器调用其他操作
_forward($action, $controller = null, $module = null, array $params = null):
以下是ZF手册Zend Action Helpers