如何将$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']));
答案 0 :(得分:1)
$this->requestAction('/reports/grid', array('form' => $this->params['form']));
答案 1 :(得分:0)
根据1.3文档,您需要在pass
或named
参数键 - 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
的理由很少。如果你还没有,请阅读性能处罚。