通过table标签,PHP输出EXCEL的实现方法
|
关键代码: <IMG alt="" src="https://files.jb51.cc/file_images/article/201307/20130724092718.png"> 答案是可以的。 实现代码: <div class="codetitle"><a style="CURSOR: pointer" data="57211" class="copybut" id="copybut57211" onclick="doCopy('code57211')"> 代码如下:<div class="codebody" id="code57211"> <?php header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=qianshou.xls"); mysql_connect("localhost","root",""); mysql_select_db("test"); mysql_query("SET NAMES GBK"); $query="select * from city "; $r=mysql_query($query); ?> <table width="200" border="1"> <tr> <td colspan="3" align="center">城市列表</td> </tr> <tr> <td align="center">id</td> <td align="center">p_id</td> <td align="center">name</td> </tr> <?php while($row=mysql_fetch_assoc($r)){ ?> <tr> <td><?php echo $row[id] ?></td> <td><?php echo $row[p_id] ?></td> <td><?php echo $row[c_name]?></td> </tr> <?php } ?> </table> <IMG alt="" src="https://files.jb51.cc/file_images/article/201307/20130724092731.png"> (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
