PHPExcel用法
来源:互联网 发布:linux sqlplus 安装 编辑:程序博客网 时间:2024/06/07 20:43
PHPExcel用法
1.没有提示直接下载到指定目录
> require_once FCPATH.'shared/libraries/PHPExcel.php';>$resultPHPExcel = new PHPExcel();>$resultPHPExcel->getActiveSheet()->setCellValue('A1', '用户UID');>$i = 2;foreach($dataList as $row){> $resultPHPExcel->getActiveSheet()->setCellValue('A' . $i, $row['uid']);> > $i++;}
导出文件
$outputFileName = 'order_'.date('Y-m-d',time()).'.xls';> // $filePath = 'APPPATH.'/logs/stat/'.date('Y/m/',time())';> $filePath = '/tmp/';> $objWriter =PHPExcel_IOFactory::createWriter($resultPHPExcel, 'Excel2007');> $objWriter->save($filePath.$outputFileName);2.有浏览器提示的下载> $outputFileName = 'batchCount'.date('Y-m-d',time()).".xls";> $xlsWriter = new PHPExcel_Writer_Excel5($resultPHPExcel);> header("Content-Type: application/force-download");> header("Content-Type: application/octet-stream");> header("Content-Type: application/download");> header('Content-Disposition:inline;filename="'.$outputFileName.'"');> header("Content-Transfer-Encoding: binary");> header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");> header("Cache-Control: must-revalidate, post-check=0, pre-check=0");> header("Pragma: no-cache");> $xlsWriter->save( "php://output" );
0 0
- PHPExcel用法
- PHPExcel用法
- phpExcel用法
- PHPExcel用法
- PHPExcel 基本用法详解
- PHPExcel 基本用法详解
- thinkphp中PHPExcel用法
- phpExcel基本用法
- PHPExcel用法(详细)
- PHPExcel基础用法
- PHPExcel用法总结
- PHPExcel 基本用法详解
- PHPExcel 基本用法详解
- PHPExcel详细用法
- PHPExcel类导入Excel用法
- PHPExcel用法详细的介绍
- phpexcel
- phpexcel
- 把块存放在页高速缓存中
- Const指针 、 指向const的指针 、引用、指针
- iOS中performSelector+@selector多参数传递解决方法
- iOS cell上的定时器
- 你不知道的TextView实现原理
- PHPExcel用法
- php file_get_contents 服务器端返回false解决方法
- 关于using声明与using编译指令 c++
- 将两个字符转化成一个十六进制数
- 自定义GridView,实现item之间相互滑动
- 数组实现链表及插入
- 万恶的db2总结
- undo空间管理(可以收缩undo log回滚日志物理文件空间)
- 关于C++程序的编码问题