PHP function header () specific method for querying a single part parsing _ PHP Tutorial

Source: Internet
Author: User
The PHP function header () is used to parse a single part. The following is a script called calling. php :! DOCTYPEHTMLPUBLIC-W3CDTDHTML4.0TransitionalENwww.w3.org today we explain how to use the specific contentThe following is a script called calling. php:

 
 
  1. "-//W3C//DTD HTML 4.0 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd" >
  3. <html>
  4. <head>
  5. <title>Calling page example title>
  6. head>
  7. <body>
  8. <a href="action.php">Click here! a>
  9. body>
  10. html>

When the user clicks the connection above, the PHP function header () will call action. php. The following is the source code of action. php:

 
 
  1. Php
  2. // Database functions
  3. // Redirect
  4. Header ("Location: $ HTTP_REFERER ");
  5. Exit;
  6. ?>

There are two common errors to be reminded:

After the PHP function header () is called, an exit statement must be included to stop the script. otherwise, subsequent scripts may be output before the header is sent.

A common error in the header () function is:

Warning: Cannot add header information-headers already sent...

The PHP function header () can only be called before HTML output. Therefore, you need to check possible empty lines and spaces before php.


The following is a script called calling. php :! DOCTYPEHTMLPUBLIC "-// W3C // DTDHTML4.0Transitional //" http://www.w3.org /...

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.