WenRou's Blog

新浪微薄腾讯微薄

最新碎语:测试图片碎语哦

您的位置:WenRou's Blog >工作> php解决excel表格导出

php解决excel表格导出

  1. header("Content-type: application/vnd.ms-excel; charset=UTF-8");  
  2. header("Content-Disposition: attachment; filename=test.xls");  
  3. echo "<table><tr><td>姓名</td><td>年龄</td></tr><tr><td>张三</td><td>15</td></tr></table>";  

php

<?php echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8 " />'; //设置内容,编码 header('Content-type:application/vnd.ms-excel');//设置请求头类型 header('Content-Disposition:filename=PreSortiong.xls');//设置导出格式 可以改 PreSortiong.xls 后缀成相应的格式
 $content = $_POST['excelContent'];//获取表格内容 echo '<table cellpadding="1" cellspacing="1" id="" border="1" bgcolor="red">'; echo $content ; echo '</table>' ?>

 

---

转载请注明本文标题和链接:《php解决excel表格导出

发表评论

30 + 1 =
路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交