在 thinkphp 3.2.3 中,在目錄 ThinkPHP\Library\Think 找到 Controller.class.php 這個文件,在代碼里面找到 dispatchJump 這個方法,找到 $this->assign(‘waitSecond','3');這行, 將里面的 3 改掉即可。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
if ( $status ) { //發送成功信息 $this ->assign( 'message' , $message ); // 提示信息 // 成功操作后默認停留1秒 if (!isset( $this ->waitSecond)) $this ->assign( 'waitSecond' , '1' ); // 默認操作成功自動返回操作前頁面 if (!isset( $this ->jumpUrl)) $this ->assign( "jumpUrl" , $_SERVER [ "HTTP_REFERER" ]); $this ->display(C( 'TMPL_ACTION_SUCCESS' )); } else { $this ->assign( 'error' , $message ); // 提示信息 //發生錯誤時候默認停留3秒 if (!isset( $this ->waitSecond)) $this ->assign( 'waitSecond' , '3' ); // 默認發生錯誤的話自動返回上頁 if (!isset( $this ->jumpUrl)) $this ->assign( 'jumpUrl' , "javascript:history.back(-1);" ); $this ->display(C( 'TMPL_ACTION_ERROR' )); // 中止執行 避免出錯后繼續執行 exit ; } |
以上這篇Thinkphp頁面跳轉設置跳轉等待時間的操作就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持服務器之家。
原文鏈接:https://blog.csdn.net/myphp2012/article/details/78425549