PHP生成Excel,然后另存为的方法
1.以下方法是直接下载(显示另存为)一个test1.xls的Excel表。<?
header("Content-type:application/xls");
header("Content-Disposition:attachment;filename=test1.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";
?>
2.下面是直接在IE中打开Excel表的header
<?
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";
?>
页:
[1]