Share Three methods of php redirection. 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. Example 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:
The code is as follows:
$ 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:
The code is as follows:
$ Url = "http://www.jb51.net ";
If (! Isset ($ url ))
{
Exit ('No jump address you ');
}
?>
Note: content = "5; url = 'http: // www.jb51.net'" indicates the jump address and will be executed in 5 seconds.
III. implement with scripts
The code is as follows:
$ Url = "http://www.jb51.net ";
Echo"