Laravel重定向分类如下:
1、a链接跳转:
<a class="btn btn-success" href="{{url('admin/organization/createAuthCodeView',%20['id'%20=>%20$list['id']])}}" rel="external nofollow" rel="external nofollow" >生成注册码</a>
2、form表单提交跳转:
<form class="form-inline" method="get" action="{{ url('admin/organization/listOrganization') }}"> <div class="form-group" style="margin-left: 20px"> <input type="hidden" name="customer_type" value="1"> <label for="perPage">每页显示数:</label> <select class="form-control" id="perPage" name="perPage"> @foreach ( [10,20,30,50] as $e) <option value="{{$e}}" {{ $e==request('perPage') ? 'selected' : '' }} >{{$e}}</option> @endforeach </select> </div> <div class="form-group" style="margin-left: 20px"> <label for="search">模糊搜索:</label> <input type="text" name="search" style="width: 400px" class="form-control" id="search" placeholder="请输入用户名或者邮箱或者电话" value="{{request('search')}}"> </div> <button type="submit" class="btn btn-primary" style="margin-left: 20px">开始搜索</button> <a href="{{url('admin/organization/createOrganization')}}" rel="external nofollow" rel="external nofollow" class="pull-right"> <button class="btn btn-primary">新增机构</button> </a> </form>
3、ajax提交跳转:
<script type="text/javascript"> $(function(){ $.ajaxSetup({ headers: { 'X-CSRF-TOKEN' : '{{ csrf_token() }}' } }); $("#generate").click(function(){ $.ajax({ url:"/admin/organization/generateAuthCode", //你的路由地址 type:"post", data:{"auth_num":$('#auth_num').val(),"organization_name":$('#organization_name').val()}, timeout:30000, success:function(data){ $("#auth_codes").val(data); }, error:function(){ console.log(data); } }); }); }) </script>
4、控制器方法里面跳转:
return redirect('/admin/organization/listOrganization');
以上这篇Laravel重定向,a链接跳转,控制器跳转示例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持NICE源码。