php导出excel最简单的办法,无需phpexcel
2017-06-29 20:17
411 查看
public function exportDayInner(){ $start_date = input('start'); $end_date = input('end'); $innerdata = Db::table('inner') ->whereTime('add_date', 'between', [$start_date,$end_date]) ->where('inner.depart_id',session('depart_id')) ->join('goods','inner.goods_id = goods.id') ->join('storage','storage.id = inner.storage_id') ->join('supplier','supplier.id = inner.supplier_id') ->join('user','user.id = inner.user_id') //->limit(5) ->order('inner.id desc') ->field('goods_name,add_date,storage_name,supplier_name,real_name,num,inner.price') ->select(); $table = ''; $table .= "<table> <thead> <tr> <th class='name'>名称</th> <th class='name'>入库日期</th> <th class='name'>入库库位</th> <th class='name'>供货商</th> <th class='name'>入库人</th> <th class='name'>数量</th> <th class='name'>单价</th> </tr> </thead> <tbody>"; foreach ($innerdata as $v) { $table .= "<tr> <td class='name'>{$v['goods_name']}</td> <td class='name'>{$v['add_date']}</td> <td class='name'>{$v['storage_name']}</td> <td class='name'>{$v['supplier_name']}</td> <td class='name'>{$v['real_name']}</td> <td class='name'>{$v['num']}</td> <td class='name'>{$v['price']}</td> </tr>"; } $table .= "</tbody> </table>"; //通过header头控制输出excel表格 header("Pragma: public"); header("Expires: 0"); header("Cache-Control:must-revalidate, post-check=0, pre-check=0"); header("Content-Type:application/force-download"); header("Content-Type:application/vnd.ms-execl"); header("Content-Type:application/octet-stream"); header("Content-Type:application/download");; header('Content-Disposition:attachment;filename="入库明细表.xls"'); header("Content-Transfer-Encoding:binary"); echo $table; }http://www.cankaojishu.com/
相关文章推荐
- php导出Excel文件(无需插件)
- php把数据表导出为Excel表的最简单、最快的方法(不用插件)
- php导出Excel文件(无需插件)
- phpexcel php导入导出excel表格的简单方法
- php导出Excel文件(无需插件)
- php自动导出excel的简单方法
- 简单的php导出excel
- php简单导出excel
- PHP导出Excel简单实例
- php 简单导出excel功能
- PHP excel导出乱码问题解决办法
- PHP导出Excel 数字末尾变0或小数点解决办法
- PHP 导出Excel (无需插件)
- php简单导出excel
- php把数据表导出为Excel表的最简单、最快的方法(不用插件)
- php 数据库中的回车换行导出excel文件时切换单元格的解决办法
- php不使用插件导出excel的简单方法
- phpexcel 简单导出多个sheet
- header()实现PHP最简单的导出excel,不需要引入操作excel类库
- php导出Excel文件简单的方法(非PHPEXCEL)