How do I redirect from one page to another in PHP? Here are a list of three options for your reference.
How do I redirect from one page to another in PHP? Here are a list of three options for your reference.
First, with HTTP header information
That is, using the header function of PHP. The function of the header function in PHP is to issue to the browser the control instructions that should have been passed through the Web server, such as declaring the type of return information ("Context-type:xxx/xxx"), the properties of the page ("No cache", " Expire ") and so on.
The way to redirect to another page with HTTP header information is as follows:
?
if (Isset ($url))
{
Header ("http/1.1 303 and Other");
Header ("Location: $url");
Exit From www.jzxue.com
}
?>
Notice that "localtion:" There is a space behind it.
Second, with HTML tags
With HTML tags, you use the Meta refresh tag, for example:
? if (!isset ($url)) exit;? >
<HTML>
<HEAD>
<meta http-equiv= "REFRESH" content= "5; url=<? echo $url;? >>
</HEAD>
<BODY>
</BODY>
</HTML>
Three, with the feet to achieve
Examples are as follows:
?
$url =http://www.jzxue.com;
echo "<!--<scrīpt language=" javascrīpt ">";
echo "location.href= ' $url '";
echo "</scrīpt>-->";
?>