PHP header function Using instance Code _php tutorial

Source: Internet
Author: User
  1. /*** function:php Header () examples (PHP)
  2. * * Desc:some examples on what to use the header () function of phpyou find a detailed tutorial at expertsrt.com (中文版) o R at Ffm.junetz.de (German). These is also a good help on caching at web-caching.com.
  3. * * Example:see below.

    Tip: You can use the these sites to check your headers:web-sniffer.net, delorie.com or www.forret.com.
  4. * * Author:jonas John
  5. */
  6. Fix 404 Pages:
  7. Header (http/1.1 OK);
  8. Set 404 Header:
  9. Header (http/1.1 404 Not Found);
  10. Set Moved permanently header (Good for redrictions)
  11. Use with location header
  12. Header (http/1.1 301 Moved permanently);
  13. Redirect to a new location:
  14. Header (location:http://www.example.org/);
  15. Redrict with delay:
  16. Header (refresh:10; url=http://www.example.org/);
  17. Print you'll be redirected in seconds;
  18. You could also use the HTML syntax:// < li="">
  19. Header (content-transfer-encoding:binary);
  20. Load the file to Send:readfile (Example.zip);
  21. Disable caching of the current document:
  22. Header (Cache-control:no-cache, No-store, max-age=0, must-revalidate);
  23. Header (Expires:mon, Jul 1997 05:00:00 GMT);
  24. Date in the Pastheader (Pragma:no-cache);
  25. Set Content Type:
  26. Header (content-type:text/html; charset=iso-8859-1);
  27. Header (content-type:text/html; charset=utf-8);
  28. Header (Content-type:text/plain);
  29. Plain text file
  30. Header (Content-type:image/jpeg);
  31. JPG picture
  32. Header (Content-type:application/zip);
  33. ZIP file
  34. Header (content-type:application/pdf);
  35. PDF file
  36. Header (Content-type:audio/mpeg);
  37. Audio MPEG (MP3,...) file
  38. Header (Content-type:application/x-shockwave-flash);
  39. Flash animation//show Sign In box
  40. Header (http/1.1 401 Unauthorized);
  41. Header (Www-authenticate:basic realm= "Top Secret");
  42. Print Text that would be displayed if the user hits cancel or;
  43. Print enters wrong login data;
  44. ?>

http://www.bkjia.com/PHPjc/486126.html www.bkjia.com true http://www.bkjia.com/PHPjc/486126.html techarticle php/*** function:php header () examples (PHP) * * Desc:some examples on what to use the header () Function of Phpyou F IND a detailed tutorial at expertsrt.com (中文版) or at FFM.J ...

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