$filePath = "7788.xls"; $PHPExcel = new PHPExcel(); $PHPReader = new PHPExcel_Reader_Excel2007(); if(!$PHPReader->canRead($filePath)){ $PHPReader = new PHPExcel_Reader_Excel5(); if(!$PHPReader->canRead($filePath)){ die('无法读取excel文件'); } } $PHPExcel = $PHPReader->load($filePath); $currentSheet = $PHPExcel->getSheet(0); $allRow = $currentSheet->getHighestRow(); for($currentRow = 2; $currentRow <= $allRow; $currentRow++){ $a_val = $currentSheet->getCell("A$currentRow")->getCalculatedValue(); $b_val = $currentSheet->getCell("B$currentRow")->getCalculatedValue(); $c_val = $currentSheet->getCell("C$currentRow")->getCalculatedValue(); echo $a_val." ".$b_val." ".$c_val." "; echo " "; }