简体   繁体   English

PHP导出表到Excel

[英]Php export table to excel

I have this code that exports a html table to excel. 我有这段代码将html表导出到excel。

print $obj->methodThatReturnTable();

header("Content-type: application/vnd.ms-excel");
header("Content-type: application/force-download");
header("Content-Disposition: attachment; filename=$fileName");
header("Pragma: no-cache");

It works fine for tables with a few rows, but now I have created a table with almost 1000 rows (8 columns) and instead of the download be forced, the table is showed in the browser. 它对于具有几行的表很好用,但是现在我创建了一个具有近1000行(8列)的表,而不是强制下载,该表显示在浏览器中。

What could be happening? 可能会发生什么?

Please check PHP: Exporting Data to Excel . 请检查PHP:将数据导出到Excel It may help you. 它可能会帮助您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM