spreadsheet 读取excel,xls,xlsx表格
2022-07-18 PHP 1638
use PhpOffice\PhpSpreadsheet\IOFactory; ...... public static function readExcel($file) { $spreadsheet = IOFactory::load($file); $sheet = $spreadsheet->getActiveSheet(); $res = []; foreach ($sheet->getRowIterator() as $row) { $tmp = []; foreach ($row->getCellIterator() as $cell) { $tmp[] = $cell->getFormattedValue(); } $res[$row->getRowIndex()] = $tmp; } return $res; }
很赞哦! (0)
相关文章
文章评论
-
-
-
0条评论