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. For example, to declare the type of the 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: <? Php
$ Url = "http://www.jb51.net ";
If (isset ($ url ))
{
Header ("Location: $ url ");
}
?>
Note: "Localtion:" There is a space behind it. If it is not added, it can also be used, but it is better to add it for correctness.
Ii. Mark with HTML
The HTML Tag is the REFRESH tag of META, for example:Copy codeThe Code is as follows: <? Php
$ Url = "http://www.jb51.net ";
If (! Isset ($ url ))
{
Exit ('no jump address you ');
}
?>
<HTML>
<HEAD>
<META HTTP-EQUIV = "REFRESH" CONTENT = "5; URL = '<? Php echo $ url;?> '">
</HEAD>
<BODY>
</BODY>
</HTML>
Note: content = "5; url = 'HTTP: // www.jb51.net'" indicates the jump address and will be executed in 5 seconds.
Iii. Implement with scriptsCopy codeThe Code is as follows: <? Php
$ Url = "http://www.jb51.net ";
Echo "<script language = \" JavaScript \ "> location. href = '$ url' </SCRIPT> ";
?>
However, I personally prefer the header method, so that the page Jump speed is faster, the user is not visually aware of the whole page Jump, but only partial changes!