我收到此错误... 注意:未定义的偏移量:第5873行的/var/www/clients/client1/web1/web/manage/Classes/PHPExcel/Reader/Excel5.php中的126 < / strong>当我尝试导入.xls文件时。然而它适用于xlsx文件。如果我将.xlsx文件作为.xls文件进行挥动,它会失败吗?
$fPath = "uploads/";
include('./Classes/PHPExcel.php');
include('./Classes/PHPExcel/IOFactory.php');
// Add file name to file path
$fPath = $fPath . basename($_FILES['fileUpload']['name']);
$ext = pathinfo($fPath, PATHINFO_EXTENSION);
if (move_uploaded_file($_FILES['fileUpload']['tmp_name'], $fPath)) {
$output = "";
if ($ext == "xlsx") {
$fileType = 'Excel2007';
} else {
$fileType = 'Excel5';
}
//echo " fileType=$fileType";
$sheetname = 'IRBIMport';
// Read the file
$objReader = PHPExcel_IOFactory::createReader($fileType);
$objReader->setReadDataOnly(true);
$objReader->setLoadSheetsOnly($sheetname);
$objPHPExcel = $objReader->load($fPath);
$excelOut = $objPHPExcel->getActiveSheet();
} else {
$output = "failed to upload";
}
如果我注释掉这一行$objPHPExcel = $objReader->load($fPath);
我没有得到错误,但我仍然不知道如何解决?
任何帮助都将不胜感激。
答案 0 :(得分:0)
文件仍然上传,我仍然可以阅读该文件,其余的代码仍然有效。
所以我刚刚将错误报告更改为ini_set('display_errors', 0);
...没有更多问题:)