如何使用php导出XLS文件并提示下载另存
PHP导出Excel格式文件(xls),只需给PHP文件加一个文件头,filename 就是导出的xls文件名,当你点击这个文件的URL时,就会提示你下载xls文件了
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/download“);
header(“Content-Disposition: attachment;filename=$filename“);
header(“Content-Transfer-Encoding: binary “);
或者
header(“Pragma: public“);
header(“Expires: 0“);
header(“Content-Type: application/force-download“);
header(“Content-Type: application/download“);
header(“Content-Disposition: attachment;filename=$fn“);
header(“Content-Transfer-Encoding: binary “);//二进制


Hi, cool post. I have been thinking about this topic,so thanks for posting. I’ll probably be subscribing to your blog. Keep up the good work