Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Redirect 科哈纳重定向_Redirect_Kohana_Routes - Fatal编程技术网

Redirect 科哈纳重定向

Redirect 科哈纳重定向,redirect,kohana,routes,Redirect,Kohana,Routes,在Kohana中提交表单后,我希望用户返回主页。 对此使用重定向是否正确 public function action_edit($id) { if (!empty($post)) { if ($post->validate()) { $this->request->redirect(Route::get('admin')->uri(array('action' => 'list')));

在Kohana中提交表单后,我希望用户返回主页。 对此使用重定向是否正确

public function action_edit($id)
{
    if (!empty($post))
    {
        if ($post->validate())
        {
            $this->request->redirect(Route::get('admin')->uri(array('action' => 'list')));

        }
    }
}

提前谢谢

重定向部分确实正确。
验证部分缺少几行。

重定向部分确实正确。
验证部分缺少几行。

有时
$this->request->uri($params)
(而不是
Route::get()->uri()
)可能有用。例如,当您想要使用当前控制器(重定向到另一个操作)或相同的路由时。默认情况下,它将使用来自当前请求的路由参数。

有时
$this->request->uri($params)
(而不是
route::get()->uri()
)可能有用。例如,当您想要使用当前控制器(重定向到另一个操作)或相同的路由时。默认情况下,它将使用当前请求中的路由参数。

谢谢。验证确实不完整,只是为了说明我的观点。谢谢非常感谢。验证确实不完整,只是为了说明我的观点。谢谢那么你不去完全相同的url,使用$params?相同的路由,但是params可能不同。然后你不去完全相同的url,使用$params?相同的路由,但是params可能不同。