php生成excel 求解解决思路

WBOY
Release: 2016-06-13 12:07:10
Original
976 people have browsed it

php生成excel 求解
在网上找了phpexcel    生成了个简单的文件, 但最后他是用save方法 保存下来的 ,好像是输出到php://output(我的理解),后台权限没过(好像不能访问这个地址,我已经登录了后台)   然后下载的文件是登录的那个网页    生成到服务器端  然后重定向下载是没问题的    但这样 我不好删除这个文件   对phpexcel不熟    求解   还是说换个库~~~

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');<br />$objWriter->save(str_replace('.php', '.xls', __FILE__));<br />$callEndTime = microtime(true);<br />$callTime = $callEndTime - $callStartTime;<br />
Copy after login


------解决思路----------------------
从 61 都 71 行都是为了向浏览器输出做的准备工作

如果你只是想保存到文件只需
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('文件名');
即可

------解决思路----------------------
换csv吧。 现在还用什么xls

fgetcsv 读
fputcsv 写

------解决思路----------------------
单纯导出Excel文件
http://jingyan.baidu.com/article/915fc414f4c2e451384b205c.html

导出带图片的Excel文件:
http://jingyan.baidu.com/article/4f7d5712aea37f1a201927d7.html

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!