<?
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls");
echo "asd\t";
echo "\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";
?>
在好好体会吧
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls");
echo "asd\t";
echo "\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";
?>
在好好体会吧
如果是这样, 建议考虑插入 Excel 表格对象, 在参数里面指定文件名
<form action='open.php' method=post>
<table>
<tr>
<td><input type=file name=filename><br>
<input type=submit value=upfile></td>
</tr>
</table>
</html>open.php
<?php
$file=fopen($filename);
//Because fopen can open file such as .xls,txt,etc.
//$filename have save the path and filename.
echo $file;
?>
<form action='open.php' method=post>
<table>
<tr>
<td><input type=file name=filename><br>
<input type=submit value=upfile></td>
</tr>
</table>
</html>open.php
<?php
$file=fopen($filename);
//Because fopen can open file such as .xls,txt,etc.
//$filename have save the path and filename.
//First, you should change the filetype xls as csv(use excel save)
echo $file;
?>
$Workbooks = $excel_id->Workbooks->Open('C:\Report.xls') or Die ("打开失败");
$sheets = $Workbooks->Worksheets(1); //表示打开那个SHEET,这里也可以用名称代
$sheets->activate; //激活SHEET
$excel->Visible = 1;//1表示显示,0表示不显示 ......... $cell = $sheets->Cells(11,5) ; //传数据给EXCEL表
$cell->value = 1234.56; ......... 各位有不明表明的发EMAIL给我:[email protected]