如何用php把查询出来的文件导出成excel表格的形式呢

WBOY
Release: 2016-06-13 13:37:47
Original
892 people have browsed it

怎么用php把查询出来的文件导出成excel表格的形式呢?
用数据库的语言导出的话,只能是整个表的信息,而且没有表头,怎么才能打印出有表头的呢

------解决方案--------------------
将内容设置为一个标准的

,文件头设置为application/vnd.ms-excel就行

需要下载的话,设置成这样:
Header( "Content-type:application/octet-stream"); 
Header( "Accept-Ranges:bytes"); 
Header( "Content-type:application/vnd.ms-excel");
Header( "Content-Disposition:attachment;filename=文档.xls");
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!