PHP 使用header函数设置HTTP头的示例方法 表头 (xlsx下载)
2020-12-13 14:28
标签:blog http java 使用 文件 os 转载 http://justcoding.iteye.com/blog/601117/ //定义编码 //Atom //CSS //Javascript //JPEG Image //JSON //PDF //RSS //Text (Plain) //XML // ok //设置一个404头: //设置地址被永久的重定向 //转到一个新地址 //文件延迟转向: //当然,也可以使用html语法实现 // 对当前文档禁用缓存 //设置内容类型: //显示登陆对话框 $filename = rtrim($_SERVER[‘DOCUMENT_ROOT‘],‘/‘).‘/app/files/payment_status.csv‘; PHP 使用header函数设置HTTP头的示例方法 表头 (xlsx下载),搜素材,soscw.com PHP 使用header函数设置HTTP头的示例方法 表头 (xlsx下载) 标签:blog http java 使用 文件 os 原文地址:http://www.cnblogs.com/yun007/p/3794044.html
header( ‘Content-Type:text/html;charset=utf-8 ‘);
header(‘Content-type: application/atom+xml‘);
header(‘Content-type: text/css‘);
header(‘Content-type: text/javascript‘);
header(‘Content-type: image/jpeg‘);
header(‘Content-type: application/json‘);
header(‘Content-type: application/pdf‘);
header(‘Content-Type: application/rss+xml; charset=ISO-8859-1‘);
header(‘Content-type: text/plain‘);
header(‘Content-type: text/xml‘);
header(‘HTTP/1.1 200 OK‘);
header(‘HTTP/1.1 404 Not Found‘);
header(‘HTTP/1.1 301 Moved Permanently‘);
header(‘Location: http://www.example.org/‘);
header(‘Refresh: 10; url=http://www.example.org/‘);
print ‘You will be redirected in 10 seconds‘;
// header(‘Content-Transfer-Encoding: binary‘);
// load the file to send:
readfile(‘example.zip‘);
header(‘Cache-Control: no-cache, no-store, max-age=0, must-revalidate‘);
header(‘Expires: Mon, 26 Jul 1997 05:00:00 GMT‘); // Date in the past
header(‘Pragma: no-cache‘);
header(‘Content-Type: text/html; charset=iso-8859-1‘);
header(‘Content-Type: text/html; charset=utf-8‘);
header(‘Content-Type: text/plain‘); //纯文本格式
header(‘Content-Type: image/jpeg‘); //JPG***
header(‘Content-Type: application/zip‘); // ZIP文件
header(‘Content-Type: application/pdf‘); // PDF文件
header(‘Content-Type: audio/mpeg‘); // 音频文件
header(‘Content-Type: application/x-shockw**e-flash‘); //Flash动画
header(‘HTTP/1.1 401 Unauthorized‘);
header(‘WWW-Authenticate: Basic realm="Top Secret"‘);
print ‘Text that will be displayed if the user hits cancel or ‘;
print ‘enters wrong login data‘;
header(‘Content-Disposition: attachment; filename=payment_status.xlsx‘);
header(‘Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet‘);
header(‘Content-Length: ‘ . filesize($filename));
header(‘Content-Transfer-Encoding: binary‘);
header(‘Cache-Control: must-revalidate‘);
header(‘Pragma: public‘);
readfile($filename);
文章标题:PHP 使用header函数设置HTTP头的示例方法 表头 (xlsx下载)
文章链接:http://soscw.com/essay/34143.html