最優(yōu)良人 » word http://www.dgkai.cn/blog 中山php|最優(yōu)網(wǎng)絡(luò) Mon, 13 May 2013 04:56:43 +0000 en hourly 1 http://wordpress.org/?v=3.1.4 php生成excel或者word文檔最簡(jiǎn)單的方法 http://www.dgkai.cn/blog/view-287.html http://www.dgkai.cn/blog/view-287.html#comments Thu, 29 Sep 2011 08:29:51 +0000 lin http://www.dgkai.cn/blog/?p=287 以下代碼實(shí)現(xiàn)簡(jiǎn)單輸出表格或者word文檔,如生成一個(gè)兩列的excel文檔,改動(dòng)相應(yīng)文件頭為

header("Content-type:application/vnd.msword");
header("Content-Disposition:filename=test.doc");

就可以輸出.doc .xls等文件格式了

header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls");
echo "test1\t";
echo "test2\t\n"; //兩列之后換行
echo "test1\t";
echo "test2\t\n";
echo "test1\t";
echo "test2\t\n";
echo "test1\t";
echo "test2\t\n";
echo "test1\t";
echo "test2\t\n";
echo "test1\t";
echo "test2\t\n";

附一個(gè)文件格式對(duì)應(yīng)的數(shù)組

$mime_types = array(
'gif' => 'image/gif',
'jpg' => 'image/jpeg',
'jpeg' => 'image/jpeg',
'jpe' => 'image/jpeg',
'bmp' => 'image/bmp',
'png' => 'image/png',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'pict' => 'image/x-pict',
'pic' => 'image/x-pict',
'pct' => 'image/x-pict',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'psd' => 'image/x-photoshop',

'swf' => 'application/x-shockwave-flash',
'js' => 'application/x-javascript',
'pdf' => 'application/pdf',
'ps' => 'application/postscript',
'eps' => 'application/postscript',
'ai' => 'application/postscript',
'wmf' => 'application/x-msmetafile',

'css' => 'text/css',
'htm' => 'text/html',
'html' => 'text/html',
'txt' => 'text/plain',
'xml' => 'text/xml',
'wml' => 'text/wml',
'wbmp' => 'image/vnd.wap.wbmp',

'mid' => 'audio/midi',
'wav' => 'audio/wav',
'mp3' => 'audio/mpeg',
'mp2' => 'audio/mpeg',

'avi' => 'video/x-msvideo',
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',

'lha' => 'application/x-lha',
'lzh' => 'application/x-lha',
'z' => 'application/x-compress',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'tgz' => 'application/x-gzip',
'tar' => 'application/x-tar',
'bz2' => 'application/bzip2',
'zip' => 'application/zip',
'arj' => 'application/x-arj',
'rar' => 'application/x-rar-compressed',

'hqx' => 'application/mac-binhex40',
'sit' => 'application/x-stuffit',
'bin' => 'application/x-macbinary',

'uu' => 'text/x-uuencode',
'uue' => 'text/x-uuencode',

'latex'=> 'application/x-latex',
'ltx' => 'application/x-latex',
'tcl' => 'application/x-tcl',

'pgp' => 'application/pgp',
'asc' => 'application/pgp',
'exe' => 'application/x-msdownload',
'doc' => 'application/msword',
'rtf' => 'application/rtf',
'xls' => 'application/vnd.ms-excel',
'ppt' => 'application/vnd.ms-powerpoint',
'mdb' => 'application/x-msaccess',
'wri' => 'application/x-mswrite',
);

]]>
http://www.dgkai.cn/blog/view-287.html/feed 3306
久久综合色站| 做暧瞹日韩精品视频| 亚洲视频三区| 精品/区二区三区| 第一色播| 亚洲AV无码成H人在线观看| www,香蕉网| 久久久精品中文字幕麻豆发布| 伦乱国产视频| 亚洲 欧美 区 自拍 先锋| 加勒比无码在线| 精品国产欧美一区二区三区成人| 亚洲天堂无码日韩| 欧洲中文字幕久久一区二区蜜乳| 另类亚洲无码| 亚洲国产日本| 国产伦一区二区三区四五区| 2020亚洲精品| 亚洲日韩欧美一区二区久久久| 太康县| 丁香五月欧美色图| 天堂在线v| 欧洲精品码一区二区三区| old色老头做受| 国产伦精品一区二区三区视频色欲| 91狠狠干| 久久噜噜| 丝袜人妻在线| 欧美一区二区 在线| 色九月丁香综合| 天天躁久久躁日日躁| 五月丁香六月综合| 中文AV在线电影| 精品国产18久久久久久| 99电影| 亚洲日韩少妇AV| 欧美亚洲日韩金品| 日韩在线香蕉| 国产成人午夜高潮毛片| 国内精品男女久久| 欧美欧美欧美|