在 KO 3.2 中将参数更改为 $this->request->uri($params( 的 uri 是否有其他选择?
例:
//Kohana 3.1 ; current uri = articles/show/10 (<controller>/<action>/<id>)
$this->request->uri(array('id' => 11)); // return 'articles/show/11'
谢谢
从 3.2 开始,没有"短"方法,因为现在$this->request->uri()
返回当前 URI。将$this->request->route()->uri()
与您需要的所有参数一起使用:
$params = array('id' => 11); // what params you want to change
$params += $this->request->param(); // current request params
$params += array(
// note that $this->request->param() doesnt contain directory/controller/action values!
'directory' => $this->request->directory(),
'controller' => $this->request->controller(),
'action' => $this->request->action(),
);
$uri = $this->request->route()->uri($params);
当然,您可以为此创建一个特殊方法(例如 $this->request->old_uri(array('id' => 11))
(。
下面是该 API 更改的问题链接。