Laravel重定向,a鏈接跳轉,控制器跳轉示例
更新時間:2019年10月22日 10:01:12 作者:SHUIPING_YANG
今天小編就為大家分享一篇Laravel重定向,a鏈接跳轉,控制器跳轉示例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
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') ? '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" 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鏈接跳轉,控制器跳轉示例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
PHP使用Apache的偽靜態(tài)功能實現“網頁404時跳轉指定頁面
這篇文章主要介紹了PHP使用Apache的偽靜態(tài)功能實現“網頁404時跳轉指定頁面,這是比較常見的頁面,文中的方法可以很好的解決,有需要的同學可以借鑒下2021-03-03
laravel-admin 添加、編輯按鈕支持攜帶參數的解決方法
通過修改源碼實現laravel-admin添加、編輯按鈕支持攜帶參數,解決一些特殊功能需求,并且不影響之前添加和編輯程序運行,本文通過實例代碼給大家介紹的非常詳細,需要的朋友參考下吧2023-11-11

