PHP Common Header Header definition

Source: Internet
Author: User
Tags readfile
  1. Header (' http/1.1 OK '); OK normal access
  2. Header (' http/1.1 404 Not Found '); Notifies the browser that the page does not exist
  3. Header (' http/1.1 301 Moved permanently '); Set the address to be permanently redirected 301
  4. Header (' location:http://www.ithhc.cn/'); Jump to a new address
  5. Header (' refresh:10; url=http://www.ithhc.cn/'); Delayed steering is a few seconds to jump
  6. Header (' x-powered-by:php/6.0.0 '); Modify x-powered-by Information
  7. Header (' content-language:en '); Document language
  8. Header (' content-length:1234 '); Set Content length
  9. Header (' last-modified: '. Gmdate (' d, D M Y h:i:s ', $time). ' GMT '); Tell the browser when it was last modified
  10. Header (' http/1.1 304 not Modified '); Tell the browser that the contents of the document have not changed
  11. # # #内容类型 # #
  12. Header (' content-type:text/html; Charset=utf-8 '); Page encoding
  13. Header (' Content-type:text/plain '); Plain Text Format
  14. Header (' Content-type:image/jpeg '); JPG, JPEG
  15. Header (' Content-type:application/zip '); ZIP file
  16. Header (' content-type:application/pdf '); PDF file
  17. Header (' Content-type:audio/mpeg '); Audio files
  18. Header (' content-type:text/css '); CSS file
  19. Header (' Content-type:text/javascript '); JS file
  20. Header (' Content-type:application/json '); Json
  21. Header (' content-type:application/pdf '); Pdf
  22. Header (' Content-type:text/xml '); Xml
  23. Header (' Content-type:application/x-shockw**e-flash '); Flash Animation
  24. ######
  25. # # #声明一个下载的文件 # #
  26. Header (' Content-type:application/octet-stream ');
  27. Header (' content-disposition:attachment; filename= ' Itblog.zip ');
  28. Header (' content-transfer-encoding:binary ');
  29. ReadFile (' Test.zip ');
  30. ######
  31. # # #对当前文档禁用缓存 # #
  32. Header (' Cache-control:no-cache, No-store, max-age=0, Must-revalidate ');
  33. Header (' Expires:mon, Jul 1997 05:00:00 GMT ');
  34. ######
  35. # # #显示一个需要验证的登陆对话框 # #
  36. Header (' http/1.1 401 Unauthorized ');
  37. Header (' Www-authenticate:basic realm= ' Top Secret ');
  38. ######
  39. # # #声明一个需要下载的xls文件 # #
  40. Header (' content-disposition:attachment; filename=ithhc.xlsx ');
  41. Header (' Content-type:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ');
  42. Header (' Content-length: '. FileSize ('./test.xls '));
  43. Header (' content-transfer-encoding:binary ');
  44. Header (' cache-control:must-revalidate ');
  45. Header (' Pragma:public ');
  46. ReadFile ('./test.xls ');
  47. ######
  48. ?>
Copy Code
PHP, Header
  • 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.