CakePHP:在requestAction调用中传递$ this-> params ['form']?

时间:2012-03-19 16:55:09

标签: cakephp cakephp-1.2

如何将$this->params['form']传递给我在requestAction中指定的控制器操作,以便我可以通过调用$this->params['form']以相同的方式使用该变量?

这是我正在尝试的(但不起作用):

$this->requestAction('/reports/grid', array('params["form"]' => $this->params['form']));
$this->requestAction('/reports/grid', array('$this->params["form"]' => $this->params['form']));

2 个答案:

答案 0 :(得分:1)

$this->requestAction('/reports/grid', array('form' => $this->params['form']));

答案 1 :(得分:0)

根据1.3文档,您需要在passnamed参数键 - http://book.cakephp.org/1.3/en/view/991/requestAction

中指定要在请求中发送的每个参数
echo $this->requestAction(array('controller' => 'articles', 'action' => 'featured'), array('named' => array('limit' => 3)));

echo $this->requestAction(array('controller' => 'articles', 'action' => 'view'), array('pass' => array(5)));

所以,它应该像

$this->requestAction('/reports/grid', array('pass' => array($this->params['form'])));

注意 - 您希望使用requestAction的理由很少。如果你还没有,请阅读性能处罚。