如何将数据从html表导出到excel?

时间:2014-09-10 06:02:36

标签: php excel

我在html文件中有一个表,想要自动将它导出到excel文件而不要求我保存或打开它。 我的代码是(在PHP中):

header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment;Filename=airport.xls");

echo "<html>";
echo "<body>";
echo "$list";
echo "</body>";
echo "</html>";

我该怎么做?

1 个答案:

答案 0 :(得分:1)

我认为你的php代码非常适合excell下载,但是你的需求与禁用弹出块的代码没关系&#34;保存或打开&#34;为此你可以推荐一些其他网站,如

Disable “Do you want to open or save this file?” download prompt"