如果您不想使用_forward,我建议您使用Zend_Session 将有问题的ID 放入会话中,或者根据您的应用程序的内部结构,使用Zend_Registry::set('variablename', $id); 在注册表中
如果您可以使用_forward,那么您应该能够从另一个控制器中的请求对象获取数据,就像您在这个控制器中所做的那样。
更新:
Forward,将您的呼叫转发到指定的控制器和操作。
转发到另一个控制器/动作。
有点像$this->_forward('nameOfAction', 'nameOfController', 'module', paramsArray)。必须给出动作,但所有其他参数都是可选的。如果需要,paramsArray 可用于传递数据。
以下内容摘自关于_forward的源文档
/**
* Forward to another controller/action.
*
* It is important to supply the unformatted names, i.e. "article"
* rather than "ArticleController". The dispatcher will do the
* appropriate formatting when the request is received.
*
* If only an action name is provided, forwards to that action in this
* controller.
*
* If an action and controller are specified, forwards to that action and
* controller in this module.
*
* Specifying an action, controller, and module is the most specific way to
* forward.
*
* A fourth argument, $params, will be used to set the request parameters.
* If either the controller or module are unnecessary for forwarding,
* simply pass null values for them before specifying the parameters.
*
* @param string $action
* @param string $controller
* @param string $module
* @param array $params
* @return void
*/
因此,如果您要在控制器 bar 中转发操作 foo,您可以这样做
$this->_forward('foo', 'bar');
在BarController
public function fooAction() {
// Get the request and continue to work with it here
$request = $this->_request();
...
}