1. Use HTTP header information
That is, use the php header function. The HEADER function in PHP is used to send control commands that should have been specified by the HTTP protocol to the browser through the WEB server, such as declaring the type of returned information ("Context-type: xxx/xxx "), page attributes (" No cache "," Expire "), and so on.
To redirect an HTTP header to another page, follow these steps:
Copy codeThe Code is as follows:
<?
If (isset ($ url ))
{
Header ("HTTP/1.1 303 See Other ");
Header ("Location: $ url ");
Exit; // from www.w3sky.com
}
?>
Note that "Localtion:" is followed by a space.
Ii. Mark with HTML
The HTML Tag is the REFRESH tag of META, for example:
Copy codeThe Code is as follows:
<? If (! Isset ($ url) exit;?>
<HTML>
<HEAD>
<META HTTP-EQUIV = "REFRESH" CONTENT = "5; URL = <? Echo $ url;?>
</HEAD>
<BODY>
</BODY>
</HTML>
Iii. Implement with scripts
Example:
Copy codeThe Code is as follows:
<?
$ Url = "http://www.jb51.net ";
Echo "<! -- <Scr limit pt LANGUAGE = "Limit Cr limit pt"> ";
Echo "location. href = '$ url '";
Echo "</scr platinum pt> --> ";
?>
Below is a supplement
Fourth:
Echo "<meta http-equiv = \" Refresh \ "content = \" seconds; url = redirected file or address \ "> ";
Where: XX indicates the number of seconds, and 0 indicates the jump immediately. refresh indicates the refresh. Url indicates the page to jump.
Fifth: Using script
<Script> url = "submit. php"; window. location. href = url; </script>
Method 6: execute scripts. The difference is that open statements can be used, and the original window, parent window, child window, or new window can be restricted.
<Script> url = "submit. php"; window. open (\ 'url, \ ', \' _ self \ '); </script>
Change \ '_ self \' to limit whether the original window is a parent window, a subwindow, or a new window. 7. Use the php built-in function to send the header information.
Header ("Location: Url ");
Fast and powerful... but there is a problem that must be pointed out: if there is html output before using this function, even if it is a space. the error message is displayed at the top of the page ..