Three ways to share Web redirect PHP redirection

Source: Internet
Author: User
Tags php redirect
First, with the HTTP header information
That is, using the header function of PHP. The function of the header function in PHP is to send the browser a control instruction that is supposed to pass through the Web server as specified by the HTTP protocol, such as declaring the type of return information ("Context-type:xxx/xxx"), the properties of the page ("No cache", " Expire ") and so on.
The following methods are used to redirect HTTP header information to another page:

Copy the Code code as follows:


$url = "Http://www.jb51.net";
if (Isset ($url))
{
Header ("Location: $url");
}
?>


Note: "Localtion:" There is a space behind, do not add sometimes can, but for correctness or added as well.
Second, with HTML tags
Use HTML markup, which is the refresh tag of meta, for example:

Copy the Code code as follows:


$url = "Http://www.jb51.net";
if (!isset ($url))
{
Exit (' No address to jump to Yo ');
}
?>


Copy the Code code as follows:


$url = "Http://www.jb51.net";
echo "";
?>


However, I personally prefer the header method, so that the page jumps faster, the user from the visual imperceptible to the whole page jump, but only local changes!

The above describes the Web redirect PHP redirect three ways to share, including the content of Web redirection, I hope to be interested in PHP tutorial friends helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.