<?  
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";  
?>  
在好好体会吧

解决方案 »

  1.   

    To hongmaohouzi(学习的人) 你的这个是创建一个Excel文件如何打开我也想知道,请指教!
      

  2.   

    是不是只要在网页上显示出来?
    如果是这样, 建议考虑插入 Excel 表格对象, 在参数里面指定文件名
      

  3.   

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

  4.   

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

  5.   

    To  xojxau(sky) 你试过,成功过吗,你本身的代码就有问题,连txt文件都打不开
      

  6.   

    我已经行了,还是要谢谢各位,我的代码如下:  $excel = new COM("Excel.Application");
      $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]