这是一个程序,从当前页面转到你想去的页面
<?php
if($url){
header("location:$url");
}
echo"<html><head>\n";
echo"<title>php</title></head>";
echo"<b>redirect to?</b><br>\n";
echo"<form action=$php_self>\n";
echo"<input type=text size=40 name=url value=http://>
<input type=submit name=submit value=submit><br>";
echo"</p></form>\n";
echo"<html>";
?>
这下你应该会了吧
<?php
if($url){
header("location:$url");
}
echo"<html><head>\n";
echo"<title>php</title></head>";
echo"<b>redirect to?</b><br>\n";
echo"<form action=$php_self>\n";
echo"<input type=text size=40 name=url value=http://>
<input type=submit name=submit value=submit><br>";
echo"</p></form>\n";
echo"<html>";
?>
这下你应该会了吧
if($url)
echo"<meta http-equiv='refresh' content='0,url=".$url."'>";
ob_start(); //打开缓冲区
?>
asdf
<?
header("location: /index.htm"); //把浏览器重定向到index.php
ob_end_flush();//输出全部内容到浏览器
?>我找到了,这样就可以了~
这种方法实际上是利用了javascript的location属性,这种方法有一个缺点,也算不上是缺点吧,是特点,就是后退的时候不好用,看情况而定~,如果你不希望用户看到前一个页面就可以这么做~,不过,后退两次也可以看到,你可以在location前加一个alert(),就看不到了~