Home > Article > Backend Development > Web page redirection, sharing of three methods of php redirection
1. Use HTTP header information
That is, use PHP’s HEADER function. The function of the HEADER function in PHP is to issue control instructions to the browser that should be passed through the WEB server specified by the HTTP protocol. For example: declare the type of return information ("Context-type: xxx/xxx"), the attributes of the page (" No cache", "Expire"), etc.
The method of redirecting to another page using HTTP header information is as follows:
Copy the code The code is as follows:
$url = "http://www.jb51.net";
if (isset($url))
{
Header("Location: $url");
}
?> It is better to add correctness.
2. Mark with HTML
The code is as follows:$url = "http://www. jb51.net";
if (!isset($url))
{
exit('No address to jump to');
}
?>
echo "";
?>
However, I personally prefer the header method, so that the page jumps faster and the user never It is not easy to visually detect the jump of the entire page, but only a partial change!
The above has introduced the sharing of three methods of web page redirection and PHP redirection, including the content of web page redirection. I hope it will be helpful to friends who are interested in PHP tutorials.