PHP Header Function Usage essentials

Source: Internet
Author: User
  1. if (true)
  2. {
  3. Header (' location:http://bbs.it-home.org ');
  4. }
  5. File_put_contents (' test.txt ', ' OK ');//This line, generate a Test.txt file, the contents of the file is OK
Copy Code

In this code, the careless programmer will think of the header (' location:http://bbs.it-home.org '); Over, in fact, the code in the background is still executed, so when using the header (location), whether it is encapsulated in another function or directly written, it is recommended to add exit () to confirm that the program is aborted.

>>> you may be interested in the article: A simple example of the PHP header () function PHP header function Implementation file download instance code PHP header function Usage Examples of PHP headers using the detailed PHP header function File download direct prompt to save code PHP header Information Application example PHP file header (header) information detailed PHP header () function using detailed PHP header message in detail

>>>

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