网络编程 
首页 > 网络编程 > 浏览文章

Laravel重定向,a链接跳转,控制器跳转示例

(编辑:jimmy 日期: 2025/12/25 浏览:3 次 )

Laravel重定向分类如下:

1、a链接跳转:

<a class="btn btn-success" href="{{url('admin/organization/createAuthCodeView', ['id' => $list['id']])}}" 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') "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" 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链接跳转,控制器跳转示例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

上一篇:laravel 解决强制跳转 https的问题
下一篇:Laravel 简单实现Ajax滚动加载示例
一句话新闻
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 网站地图 SiteMap