laravel redirect jump failure
巴扎黑
巴扎黑 2017-05-16 16:52:36
0
2
820

Jump failure in laravel
I did not write the jump in the method that comes with the controller, but customized a method to handle the jump, and then I found that there was no jump at all. . .
May I ask why? . .

private function checkExist($id){

    //获取用户是否有提交过
    $info = getIfno($id);//简写如果这条信息存在就跳转到403错误页面
    
    
    if(isset($info)){
        return Redirect::to("Error/403");
    }

}

上述方法在 index方法中调用,然后发现访问时,依然展示的是index对应的页面,而不是错误403.
巴扎黑
巴扎黑

reply all(2)
左手右手慢动作

Have you confirmed whether isset($info) is always false? If false, the code inside will not be executed.

Peter_Zhu

Is it resolved? I also encountered this problem

if(!Auth::user()->hasRole("admin")) {
    return redirect()->redirect('manage/company/list');
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template