php 生成 excel 文件

php 生成 excel 文件



[复制到剪切板]
CODE:
<?php
header
("Content-type:Application\vnd.ms-execl");
header("content-Disposition:filename=phpfans.net.xls");
?>
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<
title>php爱好着</title>
</
head>

<
body>
<
table width="600" border="1" cellpadding="0" cellspacing="0">
  <
tr>
    <
td colspan="4"><strong><a href="http://www.phpfans.net">php爱好着</a></strong><strong></strong></td>
  </
tr>
  <
tr>
    <
td width="121"><strong>代表人姓名</strong></td>
    <
td width="166">&nbsp;</td>
    <
td width="153"><strong>团队名称</strong></td>
    <
td width="150">&nbsp;</td>
  </
tr>
  <
tr>
    <
td><strong>现场联系电话:</strong></td>
    <
td>&nbsp;</td>
    <
td><strong>团队人数:</strong></td>
    <
td>&nbsp;</td>
  </
tr>
  <
tr>
    <
td><strong>角色出处:</strong></td>
    <
td>&nbsp;</td>
    <
td><strong>E-MAIL:</strong></td>
    <
td>&nbsp;</td>
  </
tr>
</
table>
</
body>
</
html> ;

毕业了。。。

xls.php

[复制到剪切板]
CODE:
<?
function 
xls_input($input)
{
   if(
$input)
   {
         foreach(
$input as $value)
        {
           echo 
"$value\t";
        }
        echo 
"\n";
  }
  else
 {
   echo 
"ERROR";
  }
}
?>
////////////////
<?
    
header("Content-type:application/vnd.ms-excel");
    
header("Content-Disposition:filename=name.xls");//这里设置要输出xls的文件名
    
$xls_title $_GET['xls_title'];//从上一页面获得xls表格标题,只考虑了一横排的.
   
$xls_content $_GET['xls_content'];
    
xls_input($xls_title);
   
xls_input($xls_content);//只考虑用户输入一条纪录;
?> ;

[ 本帖最后由 心如水流 于 2006-10-18 10:43 编辑 ]

非常感谢,使用良好