是否有任何替代方法可以将更改参数的uri作为$ this-> request-> uri($ params)在KO 3.2中获取?
示例:
//Kohana 3.1 ; current uri = articles/show/10 (<controller>/<action>/<id>)
$this->request->uri(array('id' => 11)); // return 'articles/show/11'
由于
答案 0 :(得分:3)
从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更改的issue link。