PHP常用http头
来源:互联网 发布:杭州java培训班多少钱 编辑:程序博客网 时间:2024/06/06 00:33
PHP常用Http头
404
header('HTTP/1.1 404 Not Found');
301,302
#firefox中有时会缓存301跳转所以加上了缓存过期
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: ".gmdate("D, d M Y H:i:s")."GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$url,true,301);
附件下载
header("Cache-Control: must-revalidate,post-check=0,pre-check=0");
header("Content-Description: File Transfer");
header ("Content-type: application/octet-stream");
header ("Content-Length: " .filesize ($f_name));
header ("Content-Disposition: attachment; filename=" . basename($f_name));
readfile($f_name);
PHPExcel下载
$filename='联盟排行榜'.$date.'.xlsx';
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header('Content-Disposition:inline;filename="'.$filename.'"');
header("Content-Transfer-Encoding: binary");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
$objWriter->save('php://output');
Excel
header('Content-Type: application/vnd.ms-excel');
header("Content-Disposition:attachment; filename=demo.xls");
header('Cache-Control: max-age=0');
原文链接:http://www.kubiji.cn/topic-id2507.html
- PHP常用http头
- HTTP常用消息头
- HTTP常用消息头
- HTTP常用请求头
- HTTP常用响应头
- PHP 常用header头
- php常用header头
- php判断http头还是https头
- Http 协议 常用消息头
- HTTP编程常用消息头
- PHP获取http头信息
- PHP获取http头信息
- php 设置HTTP头[备忘]
- PHP获取HTTP头信息
- PHP HTTP添加自定义头
- php header 常用头信息
- php常用的header头
- HTTP消息头(HTTP headers)-常用的HTTP请求头与响应头
- Python多线程学习
- JavaScript 语句
- 计算电磁学及其在复杂电磁环境数值模拟中的应用和发展趋势
- JavaScript 输出
- Ubuntu 查看网关地址方法
- PHP常用http头
- 探讨大数据技术,怎能漏了搜索!
- JavaWeb11-jsp.cookie.session
- 反射机制--获取类的方法
- dubboX提供rest服务
- 关于UIWebView设置高度自适应的问题
- Java 数组合并
- DEDECMS之首页空白问题
- Python安装