Php file header

Source: Internet
Author: User
Php file header
A detailed introduction to the header of the PHP file is the most detailed article that programmers have ever seen. do not miss such a good article if you have any needs.

Php file header informationDetailed description.

1. Accept: indicates the media type that the WEB server accepts. */* indicates any type, and type/* indicates all child types of the type, type/sub-type.

2. accept-Charset: indicates the character set Accept-Encoding received by the browser. the browser usually specifies the compression method, whether compression is supported, and what compression method (gzip, deflate) is supported) accept-Language: The browser declares the difference between the Language it receives and the character set: Chinese is a Language, and Chinese has multiple character sets, such as big5, gb2312, and gbk.

3. Accept-Ranges: indicates whether the WEB server accepts a request to obtain a part of an object (such as a part of a file. Bytes: Accept, none: not accept.

4. Age: when the contemporary server uses its own cached entities to respond to requests, it uses this header to indicate how long the entity has elapsed since it was generated.

5. Authorization: when the client receives the WWW-Authenticate response from the WEB server, it uses this header to respond to its authentication information to the WEB server.

6. cache-Control: request: no-cache (the entity that is not cached must be retrieved from the WEB server now) max-age: (only accept the value of Age less than max-age, and there are no expired objects) max-stale :( the objects in the past can be accepted, but the expiration time must be smaller than the max-stale value) min-fresh: (accept the cache object whose fresh life period is greater than the sum of the current Age and min-fresh values) response: public (you can use the Cached content to respond to any user) private (the user who can only respond to the previously requested content with the cached content) no-cache (this can be cached, but it can be returned to the client only after it is verified with the WEB server) max-age: (the expiration time of the objects contained in this response) ALL: no-store (cache not allowed)

7. Connection: request: close (tell the WEB server or proxy server to disconnect the Connection after the response of this request is completed. do not wait for subsequent requests of this Connection ). Keepalive (tell the WEB server or proxy server to keep the connection after the response of this request is completed and wait for subsequent requests of this connection ). Response: close (the connection has been closed ). Keepalive (the connection remains, waiting for subsequent requests from this connection ). Keep-Alive: if the browser requests to Keep the connection, the header indicates how long (in seconds) the WEB server wants to Keep the connection ). Example: Keep-Alive: 300

8. Content-Encoding: indicates the compression method (gzip and deflate) used by the WEB server to compress the objects in the response. For example, Content-Encoding: gzip Content-Language: the Language of the object that the WEB server tells the browser to respond. Content-Length: the Length of the object that the WEB server tells the browser to respond. For example, Content-Length: 26012 Content-Range: indicates the part of the object contained in the response. For example, Content-Range: bytes 21010-47021/47022 Content-Type: the Type of the object that the WEB server tells the browser to respond. For example, Content-Type: application/xml

9. ETag: indicates the flag value of an object (such as a URL). For an object, such as an html file, if it is modified, its Etag will not be modified, the role of ETag is similar to that of Last-Modified. it is mainly used by the WEB server to determine whether an object has changed. For example, if the ETag of an html file is obtained in the previous request, when the file is requested again, the browser will send the previously obtained ETag value to the WEB server, then the WEB server compares the ETag with the current ETag of the file, and then knows whether the file has changed. 10. Expired: the WEB server indicates when the object will expire. Expired objects can be used to respond to customer requests only after they are verified with the WEB server. Is the header of HTTP/1.0. Example: Expires: Sat, 23 May 2009 10:02:12 GMT

11. Host: specifies the domain name/IP address and port number of the WEB server you want to access. Example: Host: rss.sina.com.cn

12. If-Match: If the object's ETag does not change, it means that the object has not changed before the request action is executed. If-None-Match: If the ETag of the object changes, the request action is executed only when the object changes.

13. if-Modified-Since: If the requested object is Modified after the time specified in the header, the request action (such as the returned object) is executed; otherwise, code 304 is returned, tells the browser that the object has not been modified. For example, If-Modified-Since: Thu, 10 Apr 2008 09:14:42 GMT If-Unmodified-Since: If the requested object has not been Modified after the time specified in the header, to execute the request action (such as the returned object ).

14. If-Range: The browser tells the WEB server that If the requested object does not change, it will give me the part I lack. If the object changes, it will give me the entire object. The browser sends the request object's ETag or the last modification time it knows to the WEB server to determine whether the object has changed. Always used with the Range header.

15. Last-Modified: The Last modification time of the object, for example, the Last modification time of the file, and the Last generation time of the dynamic page. Example: Last-Modified: Tue, 06 May 2008 02:42:43 GMT

16. Location: The WEB server tells the browser that the object to be accessed has been moved to another Location and retrieved from the specified position in the header.

17. Pramga: mainly uses Pramga: no-cache, which is equivalent to Cache-Control: no-cache. Example: Pragma: no-cache

18. Proxy-Authenticate: the Proxy server responds to the browser and requires it to provide Proxy authentication information. Proxy-Authorization: The browser responds to the Proxy server's authentication request and provides its own identity information.

19. Range: when a browser (such as Flash get multi-thread download) tells the WEB server which part of the object it wants. Example: Range: bytes = 1173546-

20. Referer: indicates to the WEB server from which the browser obtains/clicks the URL/URL in the current request. Example: Referer: http://www.sina.com/

21. Server: indicates the software and version of the WEB Server. Example: Server: Apache/2.0.61 (Unix)

22. User-Agent: indicates the identity of the browser (which browser is used ). Example: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv: 1.8.1.14) Gecko/20080404 Firefox/2.0.0.14

23. Transfer-Encoding: the WEB server indicates the Encoding of the response message body (not an object in the message body), such as chunked ). Example: Transfer-Encoding: chunked

24. Vary: the WEB server uses the content in this header to inform the Cache server of the conditions under which the returned object can be used to respond to subsequent requests. If the source WEB server receives the first request message, its response header is: Content-Encoding: gzip; Vary: the Cache server analyzes the header of the subsequent request message and checks whether the Accept-Encoding is consistent with the Vary header value in the previous response, that is, whether the same Content Encoding method is used, this prevents the Cache server from using the compressed entity in its own Cache to respond to browsers that do not have the decompression capability. Example: Vary: Accept-Encoding

25. Via: list the proxy servers through which the responses from the client to the OCS or in the opposite direction are sent, and the protocol (and version) they use. When a client request arrives at the first proxy server, the server will add the Via header in its own request and fill in its own information, when the next proxy server receives the first request from the proxy server, it will copy the Via header of the previous proxy server request in its own request and add its own information to the back, similarly, when OCS receives the request from the last proxy server, it checks the Via header to know the route through which the request is routed. For example, Via: 1.0 236-81.D07071953.sina.com.cn: 80 (squid/2.6.STABLE13 ). After learning the theoretical knowledge, you can refer to some articles introduced by the script School that determine the file type based on the file header, combining the theory with practice.

Articles you may be interested in: Php header () function example php header function implementation File Download php header function usage php file download class (application example of header information) php header usage details php header function file when downloading directly prompts saved code php header HEADER information example PHP header message details php header function points

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.