A simple example of php reading excel files. Copy the code as follows: $ this-loadexcel (); semi-complete phpexcel file $ _ ReadExcelnewPHPExcel_Reader_Excel2007 (); if (! $_ReadExcel-canRead(link.xls) {$ _ ReadExcelnewPHPExcel _
The code is as follows:
$ This-> loadexcel (); // semi-complete phpexcel file
$ _ ReadExcel = new PHPExcel_Reader_Excel2007 ();
If (! $ _ ReadExcel-> canRead('link.xls ')){
$ _ ReadExcel = new PHPExcel_Reader_Excel5 ();
}
$ _ PhpExcel =$ _ ReadExcel-> load('link.xls ');
$ SheetCount = $ _ phpExcel-> getSheetCount ();
$ NewExcel = array ();
$ ExcelData = array ();
For ($ s = 0; $ s <$ sheetCount; $ s ++ ){
$ CurrentSheet =$ _ phpExcel-> getSheet ($ s );
$ AllColumn = $ currentSheet-> getHighestColumn ();
$ AllRow = $ currentSheet-> getHighestRow ();
For ($ r = 1; $ r <= $ allRow; $ r ++ ){
For ($ currentColumn = 'a'; $ currentColumn <= $ allColumn; $ currentColumn ++ ){
$ Address = $ currentColumn. $ r;
$ NewExcel [] = $ currentSheet-> getCell ($ address)-> getValue ();
}
}
}
The operation on the array is followed-but you need to download phpexcel and include it first
The http://www.bkjia.com/PHPjc/328155.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/328155.htmlTechArticle code is as follows: $ this-loadexcel (); // semi-complete phpexcel file $ _ ReadExcel = new PHPExcel_Reader_Excel2007 (); if (! $_ReadExcel-canRead('link.xls ') {$ _ ReadExcel = new PHPExcel _...