php导入excel php使用phpexcel导入excel文件
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Libérer: 2016-07-25 08:54:47
original
1050 Les gens l'ont consulté
-
-
//载入PHPExcel类
- include(dirname(__FILE__).'/phpexcel/PHPExcel.php');
$Obj = new PHPExcel_Reader_Excel5();
- $Obj->setReadDataOnly(true);
//读取demo.xls文件
- $phpExcel = $Obj->load(dirname(__FILE__).'/output.xls');
//获取当前活动sheet
- $objWorksheet = $phpExcel->getActiveSheet();
//获取行数
- $highestRow = $objWorksheet->getHighestRow();
//获取列数
- //by bbs.it-home.org
- $highestColumn = $objWorksheet->getHighestColumn();
- $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
//循环输出数据
- $data = array();
- for($row = 1; $row for($col = 0; $col $val = $objWorksheet->getCellByColumnAndRow($col, $row)->getValue();
- $data[$row][$col] = trim($val);
- }
- }
-
echo '
'; Copier après la connexion
- print_r($data);
- echo '';
-
复制代码
|
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Derniers articles par auteur
-
2025-02-26 03:58:14
-
2025-02-26 03:38:10
-
2025-02-26 03:17:10
-
2025-02-26 02:49:09
-
2025-02-26 01:08:13
-
2025-02-26 00:46:10
-
2025-02-25 23:42:08
-
2025-02-25 22:50:13
-
2025-02-25 21:54:11
-
2025-02-25 20:45:11