創建視圖
創建視圖success.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<!doctype html> <html lang= "{{ str_replace('_', '-', app()->getLocale()) }}" > <head> <meta charset= "utf-8" > <meta name= "viewport" content= "width=device-width, initial-scale=1" > <script src= "{{ asset('/citymedia/js/jquery-1.9.1.min.js') }}" ></script> </head> <body> <!-- 代碼 begin --> <div id= "applyFor" style= "text-align: center; width: 500px; margin: 100px auto;" > {{ $message }},將在 <span class = "loginTime" style= "color: red" >{{ $jumpTime }}</span> 秒后跳轉至 <a href= "{{$url}}" rel= "external nofollow" style= "color: red" >{{ $urlname }}</a> 頁面 </div> </body> </html> <script type= "text/javascript" > $( function (){ var url = "{{$url}}" var loginTime = parseInt($( '.loginTime' ).text()); var time = setInterval( function (){ loginTime = loginTime-1; $( '.loginTime' ).text(loginTime); if (loginTime==0){ clearInterval(time); window.location.href=url; } },1000); }) </script> |
在controller里面返回視圖
1
2
3
4
5
6
7
8
9
10
|
return view( 'citymedia.success' )->with([ //跳轉信息 'message' => '你已經提交信息,請您耐心等待!' , //自己的跳轉路徑 'url' => '/citymedia/interact' , //跳轉路徑名稱 'urlname' => '互動專區' , //跳轉等待時間(s) 'jumpTime' =>2, ]); |
以上這篇laravel添加前臺跳轉成功頁面示例就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持服務器之家。
原文鏈接:https://blog.csdn.net/touxian51552/article/details/85600689#controller_39