First, with the HTTP header information
That is, with header function. header web ( "Context-type: xxx/xxx") ("No cache", "Expire") and so on.
The following methods are used to redirect HTTP header information to another page:
Copy the code code as follows :
<?
if (Isset ($url))
{
Header ("http/1.1 303 See other");
Header ("Location: $url");
Exit From www.w3sky.com
}
?>
Notice that"localtion:" has a space behind it.
Second, with HTML tags
Use HTML markup , which is the REFRESH tag of META , for example:
Copy the code code as follows :
<? if (!isset ($url)) exit;? >
<HTML>
<HEAD>
<meta http-equiv= "REFRESH" content= "5; url=<? echo $url;? >>
</HEAD>
<BODY>
</BODY>
</HTML>
Third, the use of the script to achieve
Examples are as follows:
Copy the code code as follows :
<?
$url = "Http://www.jb51.net";
echo "<!--<scrīpt language=" Javascrīpt ">";
echo "location.href= ' $url '";
echo "</scrīpt>-->";
?>
Here are the supplemental
The fourth type :
echo "< meta http-equiv=\\" refresh\\ "content=\\" number of seconds ; url= jump file or address \ \ ">";
where : XX is the number of seconds , 0 for immediate jump . Refresh is the meaning of refreshing . The Url is the page to jump to .
The fifth type : using script to implement
<script>url= "submit.php";window.location.href=url;</script>
The sixth type: using script implementation , the difference is to use the open statement . and can restrict the original window or the parent window , child window or new window .
<script>url= "submit.php"; window.open (\ ' url,\ ' \ ', \ ' _self\ ');</script>
where the change \ ' _self\ ' can implement a jump to restrict the original window or parent window , child window or new window . Seventh Type : Use PHP Send header information with the self-function
Header ("Location:url");
The fastest and most powerful ... But there is one question that must be pointed out : If you have already used this function before HTML Output , even if it's a space . then the error message will be displayed at the top of the page ..
PHP page jump to another page of the various methods summary