PHP commonly used header header definition

Source: Internet
Author: User
Tags readfile

In the development of PHP, we often need to use the header function to mark

The header () function sends the original HTTP header to the client.

The list of common header settings is as follows:

Header' http/1.1 OK ');OK to access the header normally (' http/1.1 404 Not Found ');Notifies the browser that the page does not exist header (' http/1.1 301 Moved permanently ');Set address to be permanently redirected301header (' location:http://www.ithhc.cn/');Jump to a new address header (' Refresh:10; url=http://www.ithhc.cn/');The delayed turn is the jump header every few seconds (' x-powered-by:php/6.0.0 ');Modify the X-powered-by information header (' Content-language:en ');Document Language Header (' content-length:1234 ');Set Content Length Header (' Last-modified: '. Gmdate (' d, D M Y h:i:s ', $time).' GMT ');Tells the browser the last time the header was modified (' 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 Encoding Header (' Content-type:text/plain ');Plain Text Format header (' Content-type:image/jpeg ');JPG, JPEG header (' Content-type:application/zip ');Zip file Header (' Content-type:application/pdf ');PDF file Header (' Content-type:audio/mpeg ');Audio File Header (' Content-type:text/css ');CSS File Header (' Content-type:text/javascript ');JS File Header (' Content-type:application/json ');Jsonheader (' Content-type:application/pdf ');Pdfheader (' Content-type:text/xml ');XML Format File Header (' 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, 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 ( ' content-transfer-encoding:binary '); Header ( Pragma: Public '); ReadFile (/test.xls '); ######             

PHP commonly used header header definition

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.