PHP header()函数的使用
404
header ("HTTP/1.1 404 Not Found");
301
header ("HTTP/1.1 301 Moved Permanently");
header ("Location:http://www.baidu.com");
允许跨域
header('Access-Control-Allow-Origin:*');
下载文件1
header("Content-type: application/x-gzip");
header("Content-Disposition: attachment; filename=文件名");header("Content-Description: PHP3 Generated Data");
下载文件2
header ('Content-type: application/file');
header ("Content-Disposition: attachment; filename='test.file'");
readfile ("test.file");