A simple file download using the header () function, we simply explained the Excel operation tutorial, the need for friends can refer to.
| The code is as follows |
Copy Code |
|
Header ("Content-type:application/vnd.ms-excel");
Header ("Content-disposition:attachment;filename=test_data.xls"); |
Instance
| The code is as follows |
Copy Code |
|
$filename = "20090210.xls";
$file = fopen (public_export_dir. $filename, "R"); Open File
Header ("Content-type:application/force-download");
Header ("Accept-ranges:bytes");
Header ("Content-type:application/msexcel");
Header ("Accept-length:". FileSize (Public_export_dir. $filename));
Header ("Content-disposition:attachment;filename=". $filename);
Echo fread ($file, FileSize (Public_export_dir. $filename));
Fclose ($file); |
http://www.bkjia.com/PHPjc/631317.html www.bkjia.com true http://www.bkjia.com/PHPjc/631317.html techarticle a simple file download using the header () function, we simply explained the Excel operation tutorial, the need for friends can refer to. The code follows the copy code header (Co ...