PHP file Header (header) information detailed

Source: Internet
Author: User
Information about the header of the PHP file (header) of the detailed introduction, is the programmer's home has seen the most detailed article, the need for friends, do not miss such a good article.

PHP File header information detailed.

1. Accept: Tell the Web server what type of media you accept, */* represents any type, type/* represents all subtypes under that type, Type/sub-type.

2. Accept-charset: The browser affirms itself to receive the character set accept-encoding: The browser declares itself to receive the encoding method, usually specifies the compression method, whether compression is supported, what compression method is supported (Gzip,deflate) Accept-language:: The browser affirms that the language you receive differs from the character set: Chinese is language, Chinese has multiple character sets, such as BIG5,GB2312,GBK and so on.

3. The Accept-ranges:web server indicates whether it accepts requests to obtain a portion of its entity, such as a portion of a file. Bytes: Accept, none: Indicates not accepted.

4. Age: When the proxy server responds to a request with its own cached entity, the header is used to indicate how long the entity has been from the time it was produced to the present.

5. Authorization: When the client receives a www-authenticate response from the Web server, it uses that header to respond to its own authentication information to the Web server.

6. Cache-control: Request: No-cache (do not cache the entity, ask to fetch from the Web server Now) Max-age: (Accept only objects with an age value less than max-age value and no expiration) Max-stale: (Can accept past objects, However, the expiration time must be less than Max-stale value) Min-fresh: (accepts cached objects whose freshness life is greater than the sum of its current age and Min-fresh values) Response: public (can respond to any user with Cached content) Private (only cached content responds to the user who previously requested the content) No-cache (can be cached, but only after the Web server has verified that it is valid to be returned to the client) Max-age: (The expiration time of the object contained in this response) all: No-store (cache not allowed)

7. Connection: Request: Close (Tell the Web server or proxy server, after completing the response of this request, disconnect, do not wait for subsequent requests for this connection). KeepAlive (tells the Web server or proxy server, after completing the response of this request, remains connected, waiting for subsequent requests for this connection). Response: Close (the connection is closed). KeepAlive (connection is maintained, waiting for subsequent requests for this connection). Keep-alive: If the browser requests to remain connected, the header indicates how long (in seconds) you want the WEB server to remain connected. Example: keep-alive:300

8. The Content-encoding:web server indicates what compression method (Gzip,deflate) It uses to compress the objects in the response. For example: The Content-encoding:gzip content-language:web server tells the browser the language of the object it responds to. The Content-length:web server tells the browser the length of the object it responds to. For example: The content-length:26012 content-range:web server indicates which part of the object The response contains is part of the whole. For example: Content-range:bytes 21010-47021/47022 content-type:web The server tells the browser the type of object it responds to. Example: Content-type:application/xml

9. ETag: is an object (such as a URL) of the flag value, in terms of an object, such as an HTML file, if modified, its etag will not be modified, so, the role of the etag is similar to the role of last-modified, mainly for the WEB server to determine whether an object Has changed. For example, when a previous request for an HTML file, the ETag was obtained, and when the file is requested, the browser will send the previously obtained ETag value to the Web server, and then the Web server will compare the ETag with the current etag of the file, and then know that the file has not changed Has changed. The Expired:web server indicates when the entity will expire and, for expired objects, can be used to respond to customer requests only after it has verified its validity with the Web server. It's http/1.0 's head. Example: Expires:sat, 10:02:12 GMT

Host: The client specifies the domain/IP address and port number of the Web server that you want to access. Example: Host:rss.sina.com.cn

If-match: If the ETag of an object does not change, it actually means that the object has not changed before the requested action is executed. If-none-match: If the ETag of an object changes, it also means that the object has changed to perform the requested action.

If-modified-since: If the requested object is modified after the specified time in the header, the requested action (such as the return object) is executed, otherwise the code 304 is returned, telling the browser that the object has not been modified. For example: If-modified-since:thu, 09:14:42 GMT if-unmodified-since: Performs the requested action (such as returning an object) if the requested object has not been modified after the specified time in the header.

If-range: The browser tells the WEB server that if the object I requested doesn't change, give me the missing part, and if the object changes, give me the whole object. The browser can tell the WEB server whether the object has changed by sending the etag of the requested object or the last modification time it knows. Always used with the Range header.

Last-modified:web server considers the last modification time of the object, such as the last modification time of the file, the last generation time of the dynamic page, and so on. For example: Last-modified:tue, May 02:42:43 GMT

The Location:web server tells the browser that the object you are trying to access has been moved to a different location to fetch it at the location specified by the header.

PRAMGA: The main use of pramga:no-cache, equivalent to Cache-control:no-cache. Example: Pragma:no-cache

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.

Range: A browser (such as a Flashget multi-threaded download) tells the WEB server what part of the object you want to take. Example: range:bytes=1173546-

Referer: The browser indicates to the Web server from which page/url obtained/clicked the URL/url in the current request. Example: referer:http://www.sina.com/

The Server:web server indicates what software and version information it is. Example: server:apache/2.0.61 (Unix)

User-agent: The browser indicates its identity (which browser). For 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

The Transfer-encoding:web server indicates how it encodes the response message body (not the object inside the message body), such as whether it is chunked (chunked). Example: transfer-encoding:chunked

The Vary:web server uses the contents of the header to tell the Cache server under what conditions the object returned by this response responds to subsequent requests. If the source Web server receives the first request message, the header of its response message is: Content-encoding:gzip; Vary:content-encoding then the cache server parses the header of the subsequent request message and checks if its accept-encoding is consistent with the Vary header value of the previous response, that is, whether the same content encoding method is used, which prevents the cache The server responds to the compressed entity in its own cache to a browser that does not have the ability to decompress. Example: vary:accept-encoding

Via: Lists which proxy servers The response from the client to OCS or in the opposite direction passed, and what protocol (and version) they were using to send the request. When the client request arrives at the first proxy server, the server adds via header in its own request and fills in its own information, and when the next proxy receives a request from the first proxy server, it copies the Via header of the request from the previous proxy server in its own request. and add their own information to the back, and so on, when OCS receives the last Proxy server request, check Via header, know the route that the request passes. 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 the script of the school introduced some of the files based on the file header to determine the type of article, theory and combat combined.

you may be interested in the article : PHP header () Function example PHP header function implementation file download PHP header function usage php file download class (header information application example) PHP header using the detailed PHP header function File download direct prompt save code PHP header information Example PHP header message detailed PHP header function essentials

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