Home > Backend Development > PHP Tutorial > php导出excel表格 循环

php导出excel表格 循环

WBOY
Release: 2016-06-23 13:27:50
Original
1439 people have browsed it

php导出excel表格,需引用数据库并需要for循环。
近来查到一段代码

header("Content-Type: application/vnd.ms-excel");header("Content-Disposition: attachment; filename=example.xls");    //改成你需要的filename//注意下面的head必须,charset必须跟你将要输出的内容的编码一致,否则用Excel打开时,可能得到的是乱码。echo <<<EOT<head><meta http-equiv="Content-Type" content="text/html; charset=gbk" /><title>PHP output Excel Example</title></head><table width="100%" border="1"><tr>    <th>姓名</th>    <th>编号</th>    <th>性别</th>    <th>生日</th>    <th>城市</th></tr><tr>    <td>奥运</td>    <td>9527</td>    <td>男</td>    <td>2008-08-08</td>    <td>北京</td></tr></table>EOT;
Copy after login

但不会引用for循环
求大神帮忙。


回复讨论(解决方案)

为什么没有人啊?
求高手指点。

不知道你到底要干嘛,没法回答你啊!你是要循环导出报表吗?循环导出的话要脚本执行了,浏览器估计不能批量导出,也许可以,只是我暂时不知道

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