php导入excel
来源:互联网 发布:淘宝手机找回是真的吗 编辑:程序博客网 时间:2024/06/03 13:17
项目中要实现一个通过浏览器导入excel数据到云端数据库的功能,利用PHPExcel 可以非常方便的实现对excel文档的读取。代码如下:
/* * 读excel */ public function excelread($filename, $encode = 'utf-8') { /* 导入phpExcel核心类 注意 :你的路径跟我不一样就不能直接复制 */ require_once dirname(__FILE__) . '/../../Classes/PHPExcel.php'; // include_once('./Excel/PHPExcel.php'); /** * 读取excel $filename 路径文件名 $encode 返回数据的编码 默认为utf8 * 以下基本都不要修改 */ $objReader = PHPExcel_IOFactory::createReader('Excel5'); $objReader->setReadDataOnly(true); $objPHPExcel = $objReader->load($filename); $objWorksheet = $objPHPExcel->getActiveSheet(); $highestRow = $objWorksheet->getHighestRow(); $highestColumn = $objWorksheet->getHighestColumn(); $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); $excelData = array(); for ($row = 1; $row <= $highestRow; $row ++) { for ($col = 0; $col < $highestColumnIndex; $col ++) { $excelData[$row][] = (string) $objWorksheet->getCellByColumnAndRow($col, $row)->getValue(); } } return $excelData; }
0 0
- PHP 导入Excel
- PHP导出导入Excel
- PHP导入Excel
- PHP导入Excel
- php导入excel文件
- php 导入excel
- php导入Excel
- PHP 导入excel数据
- php excel导入
- PHP Excel 导入mysql
- PHP导入Excel文件
- php导入excel
- php导入excel数据
- PHP导入excel
- php 导入excel 方法
- php excel导入 导出
- PHP原生excel导入
- php excel 表格导入
- filter
- 当用svn切换了项目后,相应的配置需要更改
- IoTF service(a special MQTT Broker) Connectivity for Applications and Devices
- C/C++回调函数
- spring学习笔记: Spring AOP
- php导入excel
- 123123
- UVa 816 Abbott's Revenge(状态压缩BFS)
- iOS文件的操作与相关的属性
- 数据库:横表纵表互换
- 将汉字文档添加进 sqlite3 数据库
- jQuery Validate验证框架详解
- Unity3D架构系列之- FSM有限状态机设计六(总结)
- html显示列表分页的方法