簡體   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