Home  >  Article  >  Backend Development  >  thinkphp+PHPExcel import

thinkphp+PHPExcel import

WBOY
WBOYOriginal
2016-08-08 09:30:441069browse

Download PHPExcel and unzip it into the ThinkPHPExtendVendor framework

Step 2:

                Vendor('Classes.PHPExcel');
                $objPHPExcel = PHPExcel_IOFactory::load($path);
                $excelarray= $objPHPExcel->getSheet(0)->toArray();
                array_shift($excelarray);//删除数组第一行数据
                foreach ($excelarray as $k => $v) {
                  $data[$k]['字段1'] = $v[0];
                  ....
                 }
completed

The above introduces thinkphp+PHPExcel import, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn