Class' PHPExcel'在PHP

时间:2018-01-09 02:37:18

标签: php phpexcel phpexcelreader phpexcel-1.8.0

加载一个可以获取excel文件内容并在PHP上显示的程序时,可能是这个错误的原因。

  

致命错误:Class' PHPExcel'找不到   624行的C:\ xampp \ htdocs \ uploader \ PHPExcel \ Reader \ Excel5.php

下面的代码加载excel文件并获取特定的工作表。

include 'PHPExcel/IOFactory.php';

$inputFileName = 'example1.xls';

//  Read your Excel workbook
try {
    $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
    $objReader = PHPExcel_IOFactory::createReader($inputFileType);
    $objPHPExcel = $objReader->load($inputFileName);
} catch(Exception $e) {
    die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
}

//  Get worksheet dimensions
$sheet = $objPHPExcel->getSheet(0); 
$highestRow = $sheet->getHighestRow(); 
$highestColumn = $sheet->getHighestColumn();

for ($row = 1; $row <= $highestRow; $row++){ 

    //  Read a row of data into an array
    $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row,NULL,TRUE,FALSE);                              
}

根据错误,第624行仅实例化PHPExcel class,但似乎PHPExcel class上出现了问题。

0 个答案:

没有答案