php导出Excel文本

Posted on 2007-01-16 19:13 my 阅读(876) 评论(0)  编辑  收藏 所属分类: php5
<?php
//header("Content-type:application/vnd.ms-excel");
//header("Content-Disposition:filename=test.xls");

$file_type = "vnd.ms-excel";
$file_ending = "xls";

header("Content-Type: application/$file_type");
header("Content-Disposition: attachment; filename=mydowns.$file_ending");
//header("Pragma: no-cache");
header("Expires: 0");

echo "test11\t";
echo "test12\t";
echo "33\t";
echo "test14\t\n";
echo "test21\t";
echo "test22\t";
echo "33\t";
echo "test24\t\n";
echo "test31\t";
echo "test32\t";
echo "33\t";
echo "test34\t\n";
?>
访问该php后,会提示下载,选择保存后,会保存一个名为mydowns.xls的文件,可以用excel打开该文件。

只有注册用户登录后才能发表评论。


网站导航:
 

posts - 63, comments - 45, trackbacks - 0, articles - 99

Copyright © my