日期:2014-05-17  浏览次数:20539 次

php 使用过的Header收集
作者:zccst

1,Web
text/html=>html,htm
text/css=>css

text/plain=>text//重要


//(1)普通文本
header("Content-type:text/plain;charset=utf-8");
//例子
function response($arr){
	$json = json_encode($arr);
	header("Content-type:text/plain;charset=utf-8");
	print $json;
}




2,文档
application/msword=>doc
application/vnd.ms-powerpoint=>ppt
application/vnd.ms-excel=>xls
application/pdf=>pdf

application/zip=>zip
application/x-tar=>tar



//(1)导出csv格式
header("Content-type:text/csv;charset=utf-8");
header("Content-Disposition:filename={$title}.csv"); 
print iconv('utf-8', 'gb2312//IGNORE', $str);




3,图片
image/jpeg=>jpeg,jpg,jpe,png
image/gif=>gif
image/bmp=>bmp



4,音频
audio/x-wav=>wav
audio/mpeg=>mp3,mp2,mpga
audio/midi=>mid,midi,kar



5,视频
video/mpeg =>mpeg,mpg,mpe
video/quictime=>qt,mov
video/x-msvideo=>avi
video/x-sgi-movie=>movie