【www.gdgbn.com--php函数】
header(string,replace,http_response_code)
string 必需。规定要发送的报头字符串。
replace 可选。指示该报头是否替换之前的报头,或添加第二个报头。
默认是 true(替换)。false(允许相同类型的多个报头)。
http_response_code 可选。把 http 响应代码强制为指定的值。(php 4 以及更高版本可用)
跳转
header("location: http://www.111cn.net/");
发送http状态
header("status: 404 not found");
设置缓存
header("cache-control: no-cache, must-revalidate"); // http/1.1
header("expires: sat, 26 jul 1997 05:00:00 gmt");
利用header做文件下载功能
*/
header("content-type:application/pdf");
// 文件将被称为 downloaded.pdf
header("content-disposition:attachment;filename="downloaded.pdf"");
// pdf 源在 original.pdf 中
readfile("original.pdf");
?>