This article introduces the content of PHP to get Excel table data, has a certain reference value, now share to everyone, the need for friends can refer to
/* Merchant Pool import */public function Sellerpoolimport () {Import (' Component/phpexcel ', APP _path, '. php '); Introduce Excel processing class $PHPReader = new \phpexcel_reader_excel2007 (); $filePath = $_files[' url ' [' Tmp_name ']; Get upload File temp directory//Judging file type if (! $PHPReader->canread ($filePath)) {$PHPReader = new \phpexcel_reader _excel5 (); if (! $PHPReader->canread ($filePath)) {$this->error (' Please select Excel file ', U (' Seller/sellerpoolindex '), 3); }} $PHPExcel = $PHPReader->load ($_files[' url ' [' tmp_name ']); /** reading the first worksheet in an Excel file *//and to the array $currentSheetArr = $PHPExcel->getsheet (0)->toarray (); $res = D (' Seller ')->sellerpoolimport (i (' post.channeltype '), I (' Post.companycode '), $CURRENTSHEETARR); if (!is_array ($res)) $this->error ($res, U (' Seller/sellerpoolindex '), 6); $this->success (' Import succeeded ', U (' Seller/sellerpoolindex '), 3);}
Related recommendations:
Phpexcel Chinese Course