TP5中redirect实现重定向及带参数跳转
阅读原文时间:2023年07月08日阅读:1
try{
   $result = Db::name('wupin')->insert($ist);
   if($result){
   $this->redirect(url('wupin_index', ['bid' => $bid, 'process_id' => $process_id]));
   }else{
       return json(['code' => 0, 'data' => '', 'msg' => '添加失败']);
   }
   }catch( PDOException $e){
       return json(['code' => 0, 'data' => '', 'msg' => $e->getMessage()]);
   }

跳转的页面进行参数接收

$process_id=input('process_id');
$bid=input('bid');

var process_id=$("#process_id").val();
//环境物品清单,去其他页面
if(process_id==1||process_id==3){
    var url="{:url('show/wupin_index')}?bid="+id+"&process_id="+process_id;
}else if(process_id==4){
    var url="{:url('show/bl_index_index')}?bid="+id+"&process_id="+process_id;
}
else{
    var url="{:url('show/edit_assist')}?bid="+id+"&process_id="+process_id;
}

跳转到的控制器进行接收URL

$process_id=request()->get("process_id");
$bid=request()->get("bid");