PHP Set Header function Content-type

Source: Internet
Author: User
This article introduces the PHP configuration in PHP header function Content-type, has a certain reference value, now share to everyone, the need for friends can refer to

Define the coding header (' Content-type:text/html;charset=utf-8 ');//atomheader (' content-type:application/atom+xml ');// Cssheader (' content-type:text/css ');//javascriptheader (' content-type:text/javascript ');//JPEG Imageheader (' Content-type:image/jpeg ');//jsonheader (' Content-type:application/json ');//pdfheader (' content-type:application/ PDF ');//rssheader (' Content-type:application/rss+xml; charset=iso-8859-1 ');//text (Plain) header (' Content-type: Text/plain ');//xmlheader (' content-type:text/xml ');//Okheader (' http/1.1 OK ');//Set a 404 Header: Header (' http/1.1 404 Not Found ');//Set address is permanently redirected header (' http/1.1 301 Moved permanently ');//Go to a new address header (' location:https://www.lvtao.net/ ')///File Delay Turn: header (' refresh:10; url=https://www.lvtao.net/');p rint ' You'll be a redirected in seconds ';//Of course, You can also use HTML syntax to implement//<meta http-equiv= "Refresh" content= "10;https://www.lvtao.net//>//override x-powered-by:php: Header (' x-powered-by:php/4.4.0 '); header (' x-powered-by:brain/0.6b ');//Document Language header (' Content-language:en');//Tell the browser the last modification time: (+)-60; or Filemtime ($FN), Etcheader (' last-modified: '. Gmdate (' d, D M Y h:i:s ', $time). ' GMT ');//Tell the browser that the document content has not changed header (' http/1.1 304 not Modified ');//Set Content Length header (' content-length:1234 ');// Set to a download type header (' Content-type:application/octet-stream '); header (' content-disposition:attachment; Filename= ') Example.zip "'); header (' content-transfer-encoding:binary ');//load the file to Send:readfile (' example.zip ');// Disables the cache header for the current document (' Cache-control:no-cache, No-store, max-age=0, Must-revalidate '); header (' Expires:mon, 1997 Jul 05:00:00 GMT '); Date in the Pastheader (' Pragma:no-cache ');//Set Content Type: Header (' content-type:text/html; charset=iso-8859-1 '); Header (' content-type:text/html; Charset=utf-8 '); header (' Content-type:text/plain '); Plain Text Format header (' Content-type:image/jpeg '); Jpg***header (' Content-type:application/zip '); Zip file header (' Content-type:application/pdf '); PDF file Header (' Content-type:audio/mpeg '); Audio file header (' Content-type:application/x-shocKw**e-flash '); Flash animation//Display Login Dialog header (' http/1.1 401 Unauthorized '); header (' Www-authenticate:basic realm= ' Top Secret "');p rint ' Text that would be displayed if the user hits cancel or ';p rint ' enters wrong login data ';
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.