Discussion on PHP page jump several implementation skills, explore PHP page Jump _php Tutorial

Source: Internet
Author: User

Explore PHP page jump Several implementation skills, explore PHP page jump


PHP is used by many programmers to develop the web's preferred language. In the actual development, the functions of the site can be written in the PHP language to meet, such as the PHP page jump this method.

    • Discussion of PHP variable parsing order How to get commit data
    • An in-depth explanation of PHP operating mechanism
    • A brief analysis of PHP function extract () application techniques
    • For you to summarize some PHP information functions
    • PHP Query string tips sharing

In Web systems, jumping from one Web page to another is one of the most commonly used technologies in the Lamp project. Page jumps may be caused by a user clicking a link, a button, or a system that is automatically generated. Here is a general introduction of PHP in the implementation of automatic page jump method.

PHP page Jump One, header () function

The header () function is a very simple way to jump a page in PHP. The main function of the header () function is to output the HTTP protocol header (header) to the browser.

The header () function is defined as follows:

void header (String string [, bool replace [, int http_response_code]])

The optional parameter, replace, indicates whether to replace the previous similar header or to add a header of the same type, which is replaced by default.

The Second optional parameter, Http_response_code, forces the HTTP corresponding code to be set to the specified value. The header of the location type in the header function is a special header call that is commonly used to implement page jumps. Note: There can be no spaces between 1.location and ":", otherwise it will not jump.

2. There can be no output before using the header.

PHP code after 3.header will also be executed. For example, redirect your browser to the Lamp Brotherhood official forum

    1. < PHP
    2. redirect Browser
    3. Header ("Location:http://bbs.
      Lampbrother.net ");
    4. Ensure that subsequent code is not executed after redirection
    5. Exit
    6. ?>

PHP page jump two, meta tags

The META tag is the tag in HTML that is responsible for providing the meta-information of the document, which can be used in a PHP program or a page jump. If you define HTTP-EQUIV as refresh, the page will be opened to the appropriate page for a certain amount of time based on the values specified in the content.

If you set content= "seconds; url= url", you define how long it takes for the page to jump to the specified URL. For example, using meta tags to implement the vaccine after the page automatically jumps to the Lamp Brotherhood official forum.

    1. < Meta http-equiv="Refresh"
    2. content="1;url=http://
      Bbs.lampbrother.net ">

For example, the following program meta.php the page to automatically jump to bbs.lampbrother.net after a second stay in the page.

  1. < PHP
  2. $url = "http://bbs.lampbrother.net"; ?>
  3. < html>
  4. < head>
  5. < Meta http-equiv="Refresh" content= "1;
  6. Url=< php echo $url; ?> ">
  7. >
  8. < body>
  9. The page only stays for one second ...
  10. </body>
  11. >

PHP page Jump Third, JavaScript

For example, this code can be placed in any legitimate location in the program.

    1. < PHP
    2. $url = "http://bbs.lampbrother.net";
    3. echo "< script language=' javascript '
    4. type=' text/javascript '> ';
    5. echo "window.location.href=' $url '";
    6. echo "</script>";
    7. ?>

The above is we introduce to you three kinds of PHP page jump implementation method.

http://www.bkjia.com/PHPjc/1096608.html www.bkjia.com true http://www.bkjia.com/PHPjc/1096608.html techarticle Explore PHP page jump Several implementation skills, explore PHP page jump PHP is used by many programmers to develop the web's preferred language. In the actual development, the various functions of the website can be through the PHP language ...

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