跳转页面
半醉半梦半醒半痴情

老司机催更,不得不更。可我更点什么好呢?算了随便更点吧,昨天看到个跳转页面蛮好看的,于是.....省略一千字。直接把粘出来吧。

<?php 
//$t_url=$_GET['url']; //此代码无法支持带请求参数的目的地址,已弃用!
$t_url = preg_replace('/^url=(.*)$/i','$1',$_SERVER["QUERY_STRING"]); //这个支持
$xiaozhan = 'http://www.ianiu.cn/';//你的网址
if(!empty($t_url)) {
    preg_match('/(http|https):\/\//',$t_url,$matches);
    if($matches){
        $url=$t_url;
        $title='穿越时空中,请稍候...';
    } else {
        preg_match('/\./i',$t_url,$matche);
        if($matche){
            $url='http://'.$t_url;
            $title='穿越时空中,请稍候...';
        } else {
            $url=$xiaozhan;
            $title='穿越时空遇到了黑洞!正跳回小窝';
        }
    }
} else {
    $title='能源不足,正在返回...';
    $url=$xiaozhan;
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title><?php echo $title;?></title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<style type="text/css">
body{font-family:"helvetica neue",arial,sans-serif;font-size:14px;color:#444}
div{display:block}
#go_notifier{text-align:center}
#go_notifier .title{margin-top:25%;font-size:24px}
#go_notifier .main-img{margin:30px 0}
#go_notifier .sub{font-size:16px;color:#999;margin-bottom:100px}
#go_notifier .sub #time{color:#dd3a3e;padding-right:5px}
.wrapper{max-width:990px;width:100%;position:relative;margin:0 auto;border:0}
.btn{-moz-user-select:none;background:linear-gradient(#fafafa,#f2f2f2) repeat scroll 0 0 rgba(0,0,0,0);border:1px solid #d9d9d9;box-shadow:0 1px 0 #fff inset,0 1px 0 rgba(255,255,255,.3);color:#444;cursor:pointer;display:inline-block;text-align:center;text-decoration:none;text-shadow:0 1px 0 rgba(255,255,255,.5);white-space:nowrap}
.btnPlus{margin-top:24px;display:inline-block;white-space:nowrap;cursor:pointer;background:#444;letter-spacing:1px;font-size:14px;-moz-user-select:-moz-none;-webkit-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;text-shadow:none;border:1px solid #ccc;line-height:36px;text-align:center;height:36px;padding:0 25px;border-radius:16px;-webkit-transition-duration:.4s;transition-duration:.4s;background-color:#fff;color:#999}
.btnPlus:hover{color:#F77B83;border-color:#F77B83;outline-style:none}
.spinner{position:absolute;top:50%;left:50%;z-index:11;margin-top:-6px;margin-left:-60px;width:120px}
.spinner>div{width:12px;height:12px;background-color:#67CF22;border-radius:100%;display:inline-block;animation:bouncedelay 2.8s infinite ease-in-out;animation-fill-mode:both}
.spinner .bounce1{background-color:#cd402e}
.spinner .bounce2{animation-delay:-.16s;background-color:#b07da8}
.spinner .bounce3{animation-delay:-.32s;background-color:#f1b428}
.spinner .bounce4{animation-delay:-.48s;background-color:#95c0ea}
.spinner .bounce5{animation-delay:-.64s;background-color:#46b646}
@keyframes bouncedelay{
0%{transform:translate(-400px,0);opacity:0}
35%,65%{transform:translate(0,0);opacity:1}
100%{transform:translate(400px,0);opacity:0}
}
</style>
</head>
<body>
<div id="go_notifier">
    <div class="wrapper">
        <div class="title"><?php echo $title;?></div>   
        <div class="spinner">
        <div class="bounce1"></div>
        <div class="bounce2"></div>
        <div class="bounce3"></div>
        <div class="bounce4"></div>
        <div class="bounce5"></div>
        </div>
        <div class="sub">
            <span id="time">7</span><span id="cstr">秒后自动跳转</span>
        </div>
        <a href="<?php echo $url;?>" class="btn btnPlus"><span class="text"> 立刻前往</span></a>
    </div>
</div>
<script type="text/javascript">

    function toURL(url)
    {
        var delay = document.getElementById("time").innerHTML;
        if(delay > 0) {
            delay--;
            document.getElementById("time").innerHTML = delay;
        } else {
            document.getElementById("time").style.display="none";
            document.getElementById("cstr").innerHTML = "正在跳转中...<p>所花时间取决于该站的连接速度和当前网速,请耐心等待!或直接点击下面的按钮。</p>";
            location.href = url;
            return;
        }
        setTimeout("toURL('" + url + "')", 1000);
	}

    toURL("<?php echo $url;?>");

</script>
</body>
</html>

使用方法自己折腾,添加个go.php文件。

../go.php?url=要跳转的网址。

就这样。。。

「智慧源于勤奋,伟大出自平凡」

发表评论

  1. Flyer Lv.2 @回复 沙发

    好吧    还真随便

    • 瑾忆 博主 @回复 #1-1

      @Flyer:表情34我不是随便的人,但是随便起来不是人

正在获取,请稍候...
00:00/00:00