Home > Backend Development > PHP Tutorial > Web page redirection, sharing of three methods of php redirection

Web page redirection, sharing of three methods of php redirection

WBOY
Release: 2016-07-29 08:48:10
Original
1248 people have browsed it

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

Mark with HTML, that is, use the REFRESH mark of META. For example:



Copy the code

The code is as follows:$url = "http://www. jb51.net";

if (!isset($url))
{
exit('No address to jump to');
}
?>


< META HTTP-EQUIV="REFRESH" C>

Copy code
The code is as follows:$url="http://www.jb51.net";

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.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template