Ask a PHP simple header function related question

Source: Internet
Author: User
Ask a PHP simple header function question header ('content-Type: image/pjpeg '); & nbsp; header ('content-Type: application/force-download '); & nbsp; a simple header function in PHP
Header ('content-Type: image/pjpeg ');
Header ('content-Type: application/force-download ');
Header ('content-Disposition: attachment; filename = "'. $ name .'"');
Header ('content-Length: '. strlen ($ Content ));


What are these meanings? it seems very important. I know that the header is the string sent by the server before passing HTML data to the browser over HTTP,

But I still have no idea or concept about the header. Who did it send anything? Is this equivalent to the handshake signal? Or what?
I am confused.

------ Solution --------------------
The http response header of the server after the request.

HyperTextTransferProtocol is short for hypertext transfer protocol. it is used to transmit WWW data. for details about HTTP, see rfc2616. The HTTP protocol uses the request/response model. The client sends a request to the server. the request header contains the request method, URI, protocol version, and message structure similar to MIME containing the request modifier, customer information, and content. The server responds with a status line. the corresponding content includes the version of the message protocol, and the server information, entity metadata, and possible entity content are added to the success or error code.

Generally, HTTP messages include the request message sent from the client to the server and the response message sent from the server to the client. These two types of messages are composed of a starting line, one or more header fields, an empty line that is only the end of the header field, and an optional message body. The HTTP header includes four parts: common headers, request headers, response headers, and object headers. Each header field consists of a domain name, a colon (:), and a domain value. The domain name is case-insensitive. you can add any number of space characters before the domain value. The header field can be expanded to multiple rows. at least one space or tab character is used at the beginning of each line.
------ Solution --------------------
Header ('content-Type: image/pjpeg '); // output Type
Header ('content-Type: application/force-download ');
Header ('content-Disposition: attachment; filename = "'. $ name.'" '); // name of the downloaded display
Header ('content-Length: '. strlen ($ Content ));

Remember the two
Have dinner first...
------ Solution --------------------
Http protocol.

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.