【发布时间】:2012-06-24 11:42:29
【问题描述】:
在进行重定向的控制器操作中,我使用了这个:
$this->redirect(array('controller' => 'tools', 'action' => 'index'));
或者这个
$this->redirect('/tools/index');
当我通过重定向传递数据时,我使用这个:
$this->redirect('tools/index/?myArgument=12');
但我找不到如何通过“this-redirect-array”表示法传递“myargument”。
我不想使用它,因为一些路由问题:
$this->redirect(array('controller' => 'tools', 'action' => 'index', "myArgument"));
我需要这样的东西:
$this->redirect(array('controller' => 'tools', 'action' => 'index', "?myArgument=12"));
【问题讨论】:
-
正如 Jleagle 所展示的,可以使用数组概念来创建标准 RFC 3986 查询字符串,但这通常不是一个好主意。您是否有不想使用 Cake 的友好 URL 路由的特殊原因?
标签: php cakephp redirect cakephp-2.0