Home  >  Article  >  Backend Development  >  PHP导出xls问题

PHP导出xls问题

WBOY
WBOYOriginal
2016-06-23 13:42:23903browse

<?header("Content-type:application/vnd.ms-excel");header("Content-Disposition:filename=test.xls");echo "test1 ";echo "test2";echo "test1";echo "test2";echo "test1";echo "test2";echo "test1";echo "test2";echo "test1";echo "test2";echo "test1";echo "test2";?>


为什么我运行了上面代码 不会下载??


回复讨论(解决方案)

少了点东西,大小和什么东西吧、

 header("Content-type:application/octet-stream");    header("Accept-Ranges:bytes");    header("Content-type:application/vnd.ms-excel");      header("Content-Disposition:attachment;filename=".$filename.".xls");    header("Pragma: no-cache");    header("Expires: 0");

header("Content-Type: application/force-download");  
header("Content-Type: application/octet-stream");  
header("Content-Type: application/download");  
header('Content-Disposition:inline;filename="'.$FileName.'"');  
header("Content-Transfer-Encoding: binary");  
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");  
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");  
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");  
header("Pragma: no-cache");  

借别人的代码

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