繁体   English   中英

使用PHP将文件从表导出到Excel

[英]export file from table to excel using php

您好,我是编程新手,还是使用php。 下面是我的.xls代码。 我有一种形式,其中我有三个按钮,分别是添加搜索和“保存为excel”。 而且我还有一个表,其中将显示我的“添加”按钮的输出,并且该表已连接到我的数据库。 现在我的问题是,当我单击“保存为excel”按钮时,表单中的整个数据都显示为excel。 我想要的是表格中的表格只会保存在Excel中。 不是我表格中的全部数据。 如果我只能在此处发布图片,您可能会清楚地理解我。 :(。但是,我需要一些帮助。:( ..谢谢

if (isset($_POST['download']))
{
$file="document_name" . date('Ymd') . ".xls";

header("Content-type: application/vnd.ms-excel");// file extension name
header("Content-Disposition: attachment; filename=$file");

}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=line_utilization_report.xls ");
header("Content-Transfer-Encoding: binary ");

暂无
暂无

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

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