PHP导出Excel表格(最简易)
2014-10-01 14:30
253 查看
<?php header("Content-Type:text/html;charset=utf-8"); //设置字体编码,避免中文乱码 require_once("db_config.php"); ?> <?php header("Content-type:application/vnd.ms-excel"); header("Content-Disposition:filename=test.xls"); $sql="SELECT * FROM RetailersInfoTable"; $rs=mysql_query($sql); // 输出内容如下: echo iconv("UTF-8", "GBK", "网点编号")."\t"; //避免导出中文乱码 echo iconv("UTF-8", "GBK", "网点名称")."\t"; echo iconv("UTF-8", "GBK", "网点地址")."\t"; echo "\n"; while ($rows=mysql_fetch_assoc($rs)) { $rename=$rows["RetailersName"]; $add=$rows["RetailersAddress"]; echo $rows["RetailersID"]."\t"; echo iconv("UTF-8", "GBK", $rename)."\t"; echo iconv("UTF-8", "GBK", $add)."\t"; echo "\n"; } ?>
相关文章推荐
- mysql导出成excel表格的php代码
- PHP导出excel表格,PHP导出Excel报表,PHP导出Xls表格!
- php导出数据为excel表格
- PHP导出数据为excel表格
- php导入导出excel表格
- 用PHPEXCEL类库导出EXCEL表格
- 通过phpexcel导入和导出excel表格
- PHP简单导出Excel表格
- php导出excel表格
- php导出excel表格
- 用PHPEXCEL类库导出EXCEL表格
- 用php将数据库中数据导出成excel表格
- phpexcel php导入导出excel表格的简单方法
- php导出excel表格内部换行
- php导出excel表格
- php导出excel表格
- jqGrid 导出excel表格代码(php+jqgrid实例)
- PHP简单导出Excel表格
- PHP导出excel表格
- php简单导出excel表格