後臺彈出layer提示

PHP後臺彈出layer提示

layermobile 是layer手機端電腦端可用layer 的layer.msg 原理一樣!

/**
 * @param $msg 彈出提示信息
 * @param int $url 跳轉地址
 * @param float $time 延時跳轉 秒
 */
function layerExit($msg, $url=-1, $time=1.5) {
    echo '<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <script src="/static/index/js/jquery.min.2.1.4.js"></script>
    <script src="/static/index/js/layermobile/layer.js"></script></head><body style="background-color: #fff;">';

    if (!empty($msg)) {
        echo "<script>layer.open({content: '$msg',skin: 'msg',time: $time });</script>";
    }
    $time *= 1000;
    if (is_numeric($url)) {
        echo "<script>setTimeout(function(){window.history.go($url)}, $time);</script>";
    } else {
        echo "<script>setTimeout(function(){window.location.href = '$url'}, $time);</script>";
    }
    die('</body></html>');
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章