php生成excle

时间:2022-06-06 01:41:26

方法一:

新建index.php,代码如下

<?php
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=3333.xls"); echo "A1\t B1\t C1\n";
echo "A2\t B2\t C2\n";
echo "A3\t B3\t C3\n";
?>

方法二:

新建index.php,代码如下

<?php
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=3333.xls"); ?>
<table width="100%%" border="" cellspacing="" cellpadding="">
<tr>
<td>标题</td>
<td>时间</td>
</tr>
<tr>
<td>中韩渔船冲突再起</td>
<td>--</td>
</tr>
</table>