1.首先找到tp5目录下thinkphp/tpl/dispatch_jump.tpl文件
{ __NOLAYOUT__ } < ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >
< head>
< meta http- equiv= "Content-Type" content= "text/html; charset=utf-8" / >
< meta name= "viewport" content= "width=device-width,initial-scale=1.0,minimum-scale=1.0,
maximum-scale=1.0,user-scalable=no" / >
< title> 跳转提示< / title>
< style type= "text/css" >
* { padding: 0 ; margin: 0 ; }
body{ background:
Helvetica, Arial, sans- serif; color:
. system- message{ padding: 24 px 48 px; }
. system- message h1{ font- size: 100 px; font- weight: normal; line- height: 120 px;
margin- bottom: 12 px; }
. system- message . jump{ padding- top: 10 px; }
. system- message . jump a{ color:
. system- message . success, . system- message . error{ line- height: 1.8 em; font- size: 36 px;
}
. system- message . detail{ font- size: 12 px; line- height: 20 px; margin- top: 12 px;
display: none; }
< / style>
< / head>
< body>
< div class = "system-message" >
<?php switch ( $code ) { ?>
<?php case 1 : ?>
< h1> : ) < / h1>
< p class = "success" > <?php echo ( strip_tags ( $msg ) ) ; ?> < / p>
<?php break ; ?>
<?php case 0 : ?>
< h1> : ( < / h1>
< p class = "error" > <?php echo ( strip_tags ( $msg ) ) ; ?> < / p>
<?php break ; ?>
<?php } ?>
< p class = "detail" > < / p>
< p class = "jump" >
页面自动 < a id= "href" href= "<?php echo($url );?>" > 跳转< / a>
等待时间: < b id= "wait" > <?php echo ( $wait ) ; ?> < / b>
< / p>
< / div>
< script type= "text/javascript" >
( function ( ) {
var wait = document. getElementById ( 'wait' ) ,
href = document. getElementById ( 'href' ) . href;
var interval = setInterval ( function ( ) {
var time = -- wait. innerHTML;
if ( time <= 0 ) {
location. href = href;
clearInterval ( interval) ;
} ;
} , 1000 ) ;
} ) ( ) ;
< / script>
< / body>
< / html>
2.在view目录下新建一个dispatch_jump.html文件,引入html页面后页面的内容自己修改喜欢的样式内容,
以下是楼主自己引入的样式,注意查看这里的变量是否与tp5默认的dispatch_jump.tpl里的变量名称是否一致,
不一致会报错。
< ! DOCTYPE html>
< html>
< head>
< meta charset= "UTF-8" >
< title> 运超超 | 后台登录< / title>
< ! -- Tell the browser to be responsive to screen width -- >
< meta content= "width=device-width, initial-scale=1, maximum-scale=1,
user-scalable=no" name= "viewport" >
< ! -- Bootstrap 3.3 .4 -- >
< link href= "__ADMIN__/style/bootstrap/css/bootstrap.min.css" rel= "stylesheet"
type= "text/css" / >
< ! -- Theme style -- >
< link href= "__ADMIN__/style/dist/css/AdminLTE.min.css" rel= "stylesheet"
type= "text/css" / >
< ! -- iCheck -- >
< link href= "__ADMIN__/style/plugins/iCheck/square/blue.css" rel= "stylesheet"
type= "text/css" / >
< style>
< / style>
< / head>
< body class = "login-page" >
< div class = "login-box ma_t_cm" >
<?php if ( $code ) { ?>
< ! -- 处理成功-- >
< div class = "login-box-body" >
< h4 class = "login-box-msg ver_cm" > < span class = "glyphicon glyphicon-ok
ver_cm" > < / span> <?php echo ( $msg ) ; ?> < / h4>
< a href= "javascript:void(0);" > 页面自动 < a id= "href"
href= "<?php echo($url ); ?>" > 跳转< / a> 等待时间: < b id= "wait" >
<?php echo ( $wait ) ;
?> < / b> < / a> < br / > < br / >
< a href= "#" target= "_parent" > 网站前台< / a>
< a href= "#" target= "_parent" > 管理员后台< / a>
< / div>
<?php } else { ?>
< ! -- 处理失败-- >
< div class = "login-box-body" >
< h4 class = "login-box-msg ver_cm" > < span class = "glyphicon glyphicon-remove
ver_cm" > < / span> <?php echo ( $msg ) ; ?> < / h4>
< a href= "javascript:void(0);" > 页面自动 < a id= "href"
href= "<?php echo($url ); ?>" > 跳转< / a> 等待时间: < b id= "wait" >
<?php echo ( $wait ) ;
?> < / b> < / a> < br / > < br / >
< a href= "#" target= "_parent" > 网站前台< / a>
< a href= "#" target= "_parent" > 管理员后台< / a>
< / div>
<?php } ?>
< div class = "margin text-center" >
< div class = "copyright" >
2018 - { : date ( 'Y' ) } & copy; < a href= "http://www.yunchaochao.com" >
运超超< / a> < br/ >
< a href= "http://www.yunchaochao.com" > 临沂超运网络科技有限公司< / a>
< / div>
< / div>
< / div> < ! -- / . login- box -- >
< script type= "text/javascript" >
( function ( ) {
var wait = document. getElementById ( 'wait' ) , href = document. getElementById ( 'href' ) . href;
var interval = setInterval ( function ( ) {
var time = -- wait. innerHTML;
if ( time <= 0 ) {
location. href = href;
clearInterval ( interval) ;
} ;
} , 1000 ) ;
} ) ( ) ;
< / script>
< / body>
< / html>
3.接下来是最重要的一步,找到你们config.php文件下的默认跳转页面对应的模板文件代码
'dispatch_success_tmpl' = > THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl' ,
'dispatch_error_tmpl' = > THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl' ,
4.将以上默认的模板文件代码修改为自己引入的dispatch_jump.html文件,
我这里目录为app\admin\view\public\dispatch_jump.html,所以我这将默认的文件路径修改为以下路径。
'dispatch_success_tmpl' = > APP_PATH . 'admin' . DS . 'view' . DS . 'public' . DS . 'dispatch_jump.html' ,
'dispatch_error_tmpl' = > APP_PATH . 'admin' . DS . 'view' . DS . 'public' . DS . 'dispatch_jump.html' ,
5.来看一下我的跳转界面吧
![这是我的跳转界面,已经替换默认的模板文件了]
(https://img-blog.csdnimg.cn/2020011000051981.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzgzMDkyNA==,size_16,color_FFFFFF,t_70)