PHP Common Header Header Definition summary

Source: Internet
Author: User
Tags readfile

The header () function sends the original HTTP header to the client. It is important to recognize that the header () function must be called before any actual output is sent (in PHP4and later versions, you can use output caching to resolve this issue):?123456789Ten One A - - the - - - + - + A at - - - - - in - to + - the * $Panax Notoginseng - the + A the + - $ $ - - the -Wuyi the - Wu - About<?Phpheader ('http/1.1 OK');//OK normal AccessHeader'http/1.1 404 Not Found');//notifies the browser that the page does not existHeader'http/1.1 301 Moved Permanently');//set the address to be permanently redirected 301Header'location:http://www.ithhc.cn/');//jump to a new addressHeader'refresh:10; url=http://www.ithhc.cn/');//delayed steering is a few seconds to jumpHeader'x-powered-by:php/6.0.0');//Modify x-powered-by InformationHeader'Content-language:en');//Document LanguageHeader'content-length:1234');//Set Content LengthHeader'last-modified:'. Gmdate ('D, D M Y h:i:s', $time).'GMT');//tell the browser when it was last modifiedHeader'http/1.1 304 Not Modified');//Tell the browser that the contents of the document have not changed# # #内容类型 # # #header ('content-type:text/html; Charset=utf-8');//page EncodingHeader'Content-type:text/plain');//Plain Text FormatHeader'Content-type:image/jpeg');//JPG, JPEGHeader'Content-type:application/zip');//zip fileHeader'content-type:application/pdf');//PDF FileHeader'Content-type:audio/mpeg');//Audio FilesHeader'Content-type:text/css');//css FileHeader'Content-type:text/javascript');//js fileHeader'Content-type:application/json');//JSONHeader'content-type:application/pdf');//PDFHeader'Content-type:text/xml');//XMLHeader'Content-type:application/x-shockw**e-flash');//Flash Animation###### # # #声明一个下载的文件 # # #header ('Content-type:application/octet-stream'); Header ('content-disposition:attachment; filename= "Itblog.zip"'); Header ('content-transfer-encoding:binary'); ReadFile ('Test.zip'); ###### # # #对当前文档禁用缓存 # # #header ('Cache-control:no-cache, No-store, max-age=0, Must-revalidate'); Header ('Expires:mon, Jul 1997 05:00:00 GMT'); ###### # # #显示一个需要验证的登陆对话框 # # # # header ('http/1.1 401 Unauthorized'); Header ('www-authenticate:basic realm= "Top Secret"'); ###### # # #声明一个需要下载的xls文件 # # #header ('content-disposition:attachment; filename=ithhc.xlsx'); Header ('Content-type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); Header ('content-length:'. FileSize ('./test.xls')); Header ('content-transfer-encoding:binary'); Header ('cache-control:must-revalidate'); Header ('Pragma:public'); ReadFile ('./test.xls'); ######?>The above mentioned is the whole content of this article, I hope you can like. 

PHP Common Header Header Definition summary

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.