phpexcel

WBOY
WBOYOriginal
2016-06-06 20:14:191083browse

phpexcel如何把导出的文件 命名 他现在已导出就是一个export 我想定义自己的名字

回复内容:

phpexcel如何把导出的文件 命名 他现在已导出就是一个export 我想定义自己的名字

1.保存到webserver

<code>$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->save ( '文件名.xls' );
</code>

2.浏览器下载

<code>$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
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/vnd.ms-execl");
header("Content-Type:application/octet-stream");
header("Content-Type:application/download");
header("Content-Disposition:attachment;filename="文件名.xls");
header("Content-Transfer-Encoding:binary");
$objWriter->save("php://output");</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn