美化tp5.1跳轉提示


<html>
<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>
</head>
<body>
    <script src="/boot_jq/lib/jquery-3.3.1.min.js"></script>
    <script src="/boot_jq/lib/layer/layer.js"></script>
    <!--
    * $msg 待提示的消息
    * $url 待跳轉的鏈接
    * $time 彈出維持時間(單位秒)
    * icon 這里主要有兩個layer的表情,5和6,代表(哭和笑)
    -->
    <script type="text/javascript">
        (function(){
            var msg = '<?php echo(strip_tags($msg));?>';
            var url = '<?php echo($url);?>';
            // 去除.html
            url = url.replace(/\.html/, "");
            var wait = '<?php echo($wait);?>';
        <?php
            switch ($code) {
                case 1:
                        ?>
                    layer.msg(msg,{icon:"6",time:wait*1000});
                <?php
                    break;
                case 0:
                        ?>
                    layer.msg(msg,{icon:"5",time:wait*1000});
                <?php
                    break;
            }
                ?>
            setTimeout(function(){
                location.href=url;
            },1000)
        })();
    </script>
</body>
</html>

最好配置跳轉地址為自己設定的

// 默認跳轉頁面對應的模板文件
'dispatch_success_tmpl'  => Env::get('root_path') . 'tpl/dispatch_jump.tpl',
'dispatch_error_tmpl'    => Env::get('root_path') . 'tpl/dispatch_jump.tpl',

// 異常頁面的模板文件
'exception_tmpl'         => Env::get('root_path') . 'tpl/think_exception.tpl',

在根目錄下創建一個tpl文件夾。
避免每次升級thinkphp都會把跳轉給覆蓋了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM