自定义tp5的提示文件的样式

admin
2021-05-04
81

tp5

thinkphp5

自定义错误提示

1.我们这里使用到的插件是

    https://layer.layui.com/


2.找到提示文件的路径

    thinkphp/tpl/dispatch_jump.tpl

3.替换里面的代码,为了以方万一,可以做一个备份

    

{__NOLAYOUT__}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<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>

    <link href="__STATIC__/layer/mobile/need/layer.css" rel="stylesheet" />

</head>

<body>

    <div class="system-message">

    </div>

<script src="__STATIC__/admin/js/jquery.min.js"></script>

<script src="__STATIC__/layer/layer.js"></script>

    <script type="text/javascript">

        (function(){

var time = <?php echo($wait);?>;

time=parseInt(time);

var href = "<?php echo($url);?>";

$msg="<?php echo(strip_tags($msg));?>"

layer.alert($msg,function(){

window.location.href = href;

})

            var interval = setInterval(function(){

time=time-1;

console.log(time);

                if(time <= 0) {

                    location.href = href;

                    clearInterval(interval);

                };

            }, 1000);

        })();

    </script>

</body>

</html>


注意:这里引入的jquery和layer文件地址修改成自己的