我有一段代碼,警予phpexcel文件閱讀器沒有反應
$excelFile = '/tmp/sheet.xls' ;
Yii::import('application.vendors.PHPExcel',true);
$inputFileType = PHPExcel_IOFactory::identify($excelFile);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($excelFile);
$objWorkSheet = $objPHPExcel->getActiveSheet();
$highestRow = $objWorkSheet->getHighestRow();
$hightestColumn = $objWorkSheet->getHightestColumn();
$hightestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
echo '<table>'."\n" ;
for($row=2; $row<$highestRow ; ++$row){
echo '<tr>'."\n" ;
for($col=0; $col < $highestColumnIndex ; ++$col){
echo '<td>'.$objWorksheet->getCellByColumnAndRow($col,$row)->getValue().'</td>'."\n";
}
echo '</tr>'."\n" ;
}
echo '</table>'."\n" ;
但是,當這個代碼執行我沒有得到任何文件顯示。我也試圖把調試,以檢查它失敗的地方,我可以本地化錯誤getActiveSheet。 任何幫助,將不勝感激 感謝
什麼是你看到的錯誤或異常圍繞'getActiveSheet'?什麼是$ inputFileType設置爲? $ objWorkSheet在那之後設置了什麼? – ernie