header重定向方法
用header重定向的时候,可以设置下延时重定向,代码如下:
header("Refresh:5;url=index.php");
Refresh为延迟时间,url为重定向后的地址。
拎过度页面延迟跳转方法
<?php $url=$_SERVER["HTTP_REFERER"]; $str=str_replace("http://","",$url); $str=str_replace("https://","",$url); $strdomain = explode("/",$str); $domain=$strdomain[0]; if($domain==''){ empty($_SERVER['HTTP_VIA']) or exit('Access Denied');//防止快速创下 session_start(); $seconds = '30'; //时间段[秒] $refresh = '3'; //刷新次数 //设置监控变量 $cur_time = time(); if(isset($_SESSION['last_time'])){$_SESSION['refresh_times'] += 1; }else{$_SESSION['refresh_times'] = 1;$_SESSION['last_time'] = $cur_time;} //处理监控结果 if($cur_time - $_SESSION['last_time'] < $seconds){if($_SESSION['refresh_times'] >= $refresh){ //跳转至攻击者服务器地址 header(sprintf('Location:%s', 'http://127.0.0.1'));exit('Access Denied');} }else{$_SESSION['refresh_times'] = 0;$_SESSION['last_time'] = $cur_time;} echo 'Access Denied';exit;} //重定向结果 $urlhttp= strtolower(substr($_REQUEST["url"],0,7)); $urlhttps=strtolower(substr($_REQUEST["url"],0,8)); if($urlhttp=='http://'||$urlhttps=='https://'){$slurl=$_REQUEST["url"];}else{$slurl='http://'.$_REQUEST["url"];} $web=preg_replace('/(http:\/\/|https:\/\/|)*/','',$_REQUEST["url"]); header("HTTP/1.1 301 Moved Permanently"); header("Refresh:3;url=".$slurl.""); ?>网页3秒将跳转至<?php echo $web;?> 您所访问的页面将跳转至第三方网站,可能会有安全风险,盼知晓!!!
3秒后将自动为你重定向到<?php echo $web;?>
本页由舍力提供更多
使用方法:建立一个文件夹例如go,然后在文件夹中创立一个index.php文件,把上面的代码放进到这个index.php文件中即可。