Three ways to learn PHP redirection _php Tutorial

Source: Internet
Author: User
One using 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:

$url = http://www.bkjia.com;
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:

$url = http://www.bkjia.com;
if (!isset ($url))
{
Exit (' No address to jump to Yo ');
}
?>








Note: where content= "5; Url= ' http://www.bkjia.com ', which represents the address of the jump and executes after 5 seconds.

Third, the use of the script to achieve

$url =http://www.bkjia.com;
echo "";
?>


The best way to use the header, so that the page jumps faster, the user from the visually difficult to detect the whole page jump, but only local changes!

http://www.bkjia.com/PHPjc/371651.html www.bkjia.com true http://www.bkjia.com/PHPjc/371651.html techarticle First , with the HTTP header information is also used in PHP header function. 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 .

  • 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.