吴伟贤のBlog

Feed Rss

PHP导出csv excel 格式的文件

02.10.2009, php, by .

CVS的例子

<?
header("Content-type:application/vnd.ms-excel"
);
header("Content-Disposition:filename=test.csv"
);
echo
"test1,"
;
echo
"test2,"
;
echo
"test1,"
;
echo
"test2,"
;
echo
"test1,"
;
echo
"test2,"
;
echo
"test1,"
;
echo
"test2,"
;
echo
"test1,"
;
echo
"test2,"
;
echo
"test1,"
;
echo
"test2\t\n"
;
?>

EXCEL的例子

<?
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"
;
?>

评论已关闭。