php常见的header操作

  1. 404:
    header ("HTTP/1.1 404 Not Found");
  2. 301:
    header ("HTTP/1.1 301 Moved Permanently"); 
    header ("Location:http://www.baidu.com");
  3. 下载文件:
    header ('Content-type: application/file');
    header ("Content-Disposition: attachment; filename='test.file'");
    readfile ("test.file");
  4. 允许跨域:
    header('Access-Control-Allow-Origin:*');
  5. 设置自定义header头:
    header('Access-Control-Allow-Headers:WWW-Authenticate,Authorization,Set-Cookie,X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version,name');

本文题目:php常见的header操作
标题URL:http://csruizhi.cn/article/gogcjs.html

其他资讯

Copyright © 2007-2024 成都优众联杰科技有限公司 All Rights Reserved 蜀ICP备2024116266号
友情链接: 上市集团网站建设 网站建设推广 成都网站建设 重庆企业网站建设 手机网站制作设计 成都网站建设公司 网站设计 梓潼网站设计 成都网站设计公司 成都企业网站制作 网站建设 成都网站建设 成都网站制作 网站制作公司 成都营销网站制作 成都网站设计 成都网站制作 成都网站制作 外贸网站建设 成都网站设计 温江网站设计 网站设计制作报价