There is no reason to have any output before headers and session_start in PHP

Source: Internet
Author: User
PHP can not have any output before the header and Session_Start: in the HTTP transmission text, the header and the content order must be: header in the previous content after

The reason why PHP cannot have any output before headers and session_start is that in HTTP transmission text, the header and content order must be: the header is in front of the content, and the format of the header must meet the "keyword:value\n" format.

1, in the header output before the output, it will cause the wrong understanding of the header (although now can be fault-tolerant), such as not to meet the "keyword:value\n" format is OK, direct error, but to meet the "keyword:value\n" After this format, does the client install the wrong understanding, or follow the correct understanding?

2, session Open is the implied trigger whether to use the header ("Set-cookie:sid=xxxxxx"), that is, in fact, an implicit header call.

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