Header function in PHP

Source: Internet
Author: User

The function of the header () function in PHP is to send header information to the client.
What is header information?
Here is a simple explanation, detailed self-view HTTP protocol.
In the HTTP protocol, the server side of the answer (response) content includes two parts: header information (headers) and body content, where the header information is not the What is the use of the header information?
The function of the head information is many, the main one has the following several:
1, Jump: When the browser to accept the header information in the Location:xxxx, will automatically jump to xxxx point to the URL address, this is a bit like with JS write jump. But this jump only browser know, regardless of the contents of the content, the user can not see.

2, specify the content of the Web page: the same XML file, if the header information is specified: Content-type:application/xml, the browser will be in accordance with the XML file format parsing. However, if the header message is: Content-type:text/xml, the browser will treat it as a text parsing. (The browser does not parse the file by extension)

Do not know if you have noticed, sometimes in some sites to download things, click to download the connection, the result browser will be the attachment as a Web page opened, the display is garbled, the problem is also related to the header information. Sometimes the browser according to Content-type to determine whether to open or save, so that sometimes you can judge the error (mainly the site designer forgot to write Content-type). In fact, there is another can be to specify the content as an attachment, need to save, this is: content-disposition:attachment; Filename= "xxxxx"

Http://zhidao.baidu.com/link?url=fHbnmwvDP28fSoTpD3s5bnXgA2ndoegXoXXxh5CBNGF7iwrk7f-tejIwE3WU-iyRRultSESINiTmRw6ZFkjE5_

Header function in PHP

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.