PHPheader function usage

Source: Internet
Author: User
PHP100 is the first professional website in China to share PHP resources. It also provides a PHP Chinese communication community. For PHP study researchers: The latest PHP information, original content, open source code and PHP video tutorials and other related content. [Introduction] in php, the header () function is very useful, especially when ajax is used. The following is a detailed description of the header.

In php, the header () function is very useful, especially when ajax is used.

The following is a detailed description of the header.

 // Override X-Powered-By: PHP: header ('x-Powered-By: PHP/4.4.0 '); header ('x-Powered-: brain/0.6b '); // content language (en = English) header ('content-language: en'); // last modified (good for caching) $ time = time ()-60; // or filemtime ($ fn), etc header ('last-Modified :'. gmdate ('d, d m y h: I: S', $ time ). 'gmt'); // header for telling the browser that the content // did not get changed header ('H TTP/1.1 304 Not Modified '); // set content length (good for caching): header ('content-Length: 1234'); // Headers for an download: 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'); // Disable caching of the current document: header ('cache- Control: no-cache, no-store, max-age = 0, must-revalidate '); header ('expires: Mon, 26 Jul 1997 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 file header ('content-Type: image/jpeg '); // JPG picture header ('cont Ent-Type: application/zip '); // ZIP file header ('content-Type: application/pdf'); // PDF file header ('content-Type: audio/mpeg '); // Audio MPEG (MP3 ,...) File header ('content-Type: application/x-shockwave-Flash'); // flash animation // show sign in box header ('http/1.1 401 unauthorized '); header ('www-Authenticate: Basic realm = "Top Secret" '); print 'text that will be displayed if the user hits cancel or '; print 'enters wrong login data';?>

The above is a detailed description of the PHP header function usage. For more information, see other related articles in the first PHP community!

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.