PHPExcelReader文件无法加载

时间:2015-05-05 06:15:51

标签: php phpexcel phpexcelreader

我正在使用PHPExcelReader来阅读Excel表格。这是我的代码。

PriorityQueue

此代码适用于以下行。

remove()

打印'内部尝试',之后没有任何反应。没有任何异常或错误消息。这是我的日志。

<?php
    error_reporting(E_ALL ^ E_NOTICE);
    /** Include path **/
    set_include_path(get_include_path() . PATH_SEPARATOR . 'libs/Classes/');

    /** PHPExcel_IOFactory */
    include 'PHPExcel/IOFactory.php';

function sheetData($Logg, $empID, $DID) {
    $Logg->WriteLog('*************************Starting to validate DID number*************************');
    $Logg->WriteLog('Params->EmployeeID: '.$empID);
    $Logg->WriteLog('Params->DID: '.$DID);

    $inputFileName = '/apps/web/htdocs/Database_all.xlsx';  // File to read

    $Logg->WriteLog('inputFileName: '.$inputFileName);

    try {
        $Logg->WriteLog('inside try');
        $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
        $Logg->WriteLog($objPHPExcel);
    } catch(Exception $e) {
        die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
        $Logg->WriteLog('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
    }

    $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
    $isDIDMatched=false;

    $x = 2;
    while($x <= sizeof($sheetData)) {
        $Logg->WriteLog('Inside loop');
        $employee_id = isset($sheetData[$x]['A']) ? $sheetData[$x]['A'] : '';

        if (strcmp($employee_id, $empID)==0) {
            $Logg->WriteLog('Inside IF');
            $DID_num = isset($sheetData[$x]['D']) ? $sheetData[$x]['D'] : '';
            if (strcmp($DID, $DID_num)==0) {
                $Logg->WriteLog('From excel->EmployeeID: '.$employee_id);
                $Logg->WriteLog('From excel->DID number: '.$DID_num);
                $Logg->WriteLog('DID number matched');
                $isDIDMatched=true;
                break;
            }
         } 
    $x++;
}
    $Logg->WriteLog('*************************End validating DID number*************************');

    return $isDIDMatched;    
}

?>

我使用的是PHP版本5.3.28

任何建议都将不胜感激。

谢谢

0 个答案:

没有答案