content-type,_php tutorial To set common file types in PHP header

Source: Internet
Author: User
Tags readfile

PHP header sets the common file type of Content-type,


In PHP, you can send header information through the header function, you can also set the file Content-type, the following collation of some common file types for the Content-type value.

Date 2015-06-22//defines the coded 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 the address to be permanently redirected to the header (' http/1.1 301 Moved permanently '); Go to a new address header (' location:http://www.example.org/'); File Delay Steering: header (' refresh:10; url=http://www.example.org/');p rint ' You'll be redirected in seconds '; Of course, you can also use HTML syntax to implement//
 
  
 

The above mentioned is the whole content of this article, I hope you can like.

http://www.bkjia.com/PHPjc/1021088.html www.bkjia.com true http://www.bkjia.com/PHPjc/1021088.html techarticle PHP Header Set common file types of Content-type, in PHP can be sent through the header function headers, you can also set the file Content-type, the following collation of some common file classes ...

  • 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.