Phpheader () function

Source: Internet
Author: User
Header (string, replace, http_response_code) string is required. the required header string replace is optional, indicating whether to replace the previous header or add a second header.

Header (string, replace, http_response_code)

String is required, which specifies the header string to be sent.

Optional. indicates whether to replace the previous header or add a second header.

The default value is true (replace) and false (multiple headers of the same type are allowed ).

Http_response_code (optional) sets the http response code to the specified value (php 4 and later versions are available)

Jump:

Header ('Location: http://www.phpfensi.com/'); send http status

Header ("status: 404 not found ");

Set cache:

Header ("cache-control: no-cache, must-revalidate"); // http/1.1

Header ("expires: sat, 26 jul 1997 05:00:00 gmt ");

Use the header for file download:

  1. Header ("content-type: application/pdf"); // The file will be called downloaded.pdf
  2. Header ("content-disposition: attachment?filename='downloaded='"); // The pdf source is in original #
  3. Readfile ("original.pdf ");

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.