PHP in the writing will sometimes user page jump, here collected a few good jump methods, you can use.
Using HTTP header information to implement
That is, using the header function of PHP. The function of the header function in PHP is to issue to the browser the control instructions that should have been passed through the Web server, such as declaring the type of return information ("Context-type:xxx/xxx"), the properties of the page ("No cache", " Expire ") and so on.
The way to redirect to another page with HTTP header information is as follows:
The
code is as follows:
;?
if (isset ($url))
{
Header ("http/1.1 303");
Header ("Location: $url");
exit; //
}
?>
Using HTML tags
With HTML tags, you use the Meta refresh tag, for example:
The
code is as follows:
;? if (!isset ($url)) exit;? >
<HTML>
<HEAD>
<meta http-equiv= "REFRESH" content= "5; url=<? echo $url;? >>
</HEAD>
<BODY>
</BODY>
</HTML>
With the script to achieve
The
code is as follows:
;?
$url = "Http://www.3LIAN.net";
echo "<!--<scrīpt language=" javascrīpt ">";
echo "location.href= ' $url '";
echo "</scrīpt>-->";
?>
Leveraging HTML Features
The
code is as follows:
echo "< meta http-equiv=" Refresh "content=" number of seconds; Url= jump to the 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 which you want to jump.
Using script to implement
The
code is as follows:
echo ' <script>url= ' submit.php ';window.location.href=url;</script> ';
Another way to use script implementation
Using the script implementation, the difference is to use the Open statement. And you can restrict whether the original window is a parent window, a child window, or a new window.
The
code is as follows:
<script>url= "submit.php"; window.open (' url, ', ' _self ');</script>
Where change ' _self ' can be implemented to restrict the original window or the parent window, the child window, or the new window. Seventh: Use PHP to send the head information with a function
The
code is as follows:
header ("Location:url");
Fast, powerful ... But there is one problem that must be noted: If you have HTML output before using this function, even a space. The error message appears at the top of the page ...