php 怎么获取excel文件名

如题所述

第1个回答  2017-09-29
<?php
////////////////////////////////// BEGIN SETUP
$filename ="document_name.xls";
header('Content-type: application/ms-excel');
header('Content-Disposition: attachment; filename='.$filename);
////////////////////////////////// END SETUP
////////////////////////////////// BEGIN GATHER
// Your MySQL queries, fopens, et cetera go here.
// Cells are delimited by \t
// \n is just like you might expect; new line/row below
// E.G:
$stuff="PART\tQTY\tVALUE\t\n";
$stuff=$stuff."01-001-0001\t37\t28.76\t\n";
$stuff=$stuff."01-001-0002\t6\t347.06\t\n";
$stuff=$stuff."01-001-0003\t12\t7.11\t\n";
////////////////////////////////// END GATHER
// The point is to get all of your data into one string and then:
////////////////////////////////// BEGIN DUMP
echo $stuff;
////////////////////////////////// END DUMP
?>本回答被提问者采纳