There is no output reason analysis before header and session_start in PHP
- 2020-05-27 04:29:32
- OfStack
In the http transmission text, it is stipulated that the order of header and content must be: header before content, and header format must satisfy the format of "keyword: value\n".
1. If there is any output content before the output of header, it will cause a wrong understanding of header (although it is now error tolerant). For example, if the format "keyword: value\n" is not satisfied, it will be directly wrong, but after the format "keyword: value\n" is satisfied, will the client install the wrong understanding or correct understanding?
2. When session is enabled, it is implied whether header(" Set-Cookie: sid=xxxxxx ") is used for triggering, which means that it is actually an implicit header call
1. If there is any output content before the output of header, it will cause a wrong understanding of header (although it is now error tolerant). For example, if the format "keyword: value\n" is not satisfied, it will be directly wrong, but after the format "keyword: value\n" is satisfied, will the client install the wrong understanding or correct understanding?
2. When session is enabled, it is implied whether header(" Set-Cookie: sid=xxxxxx ") is used for triggering, which means that it is actually an implicit header call