Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
检查PHPExcel中的单元格迭代器是否有效_Php_Phpexcel - Fatal编程技术网

检查PHPExcel中的单元格迭代器是否有效

检查PHPExcel中的单元格迭代器是否有效,php,phpexcel,Php,Phpexcel,我有一组使用PHPExcel库编写的代码。然而,有时它工作,有时它崩溃 它专门中断的代码是foreach循环的声明 $cellIterator = $row->getCellIterator(); $cellIterator->setIterateOnlyExistingCells(false); foreach ($cellIterator as $cell){ // <-- Breaks here // Do the Thing } 以什么方式中断?您会遇到什么错

我有一组使用PHPExcel库编写的代码。然而,有时它工作,有时它崩溃

它专门中断的代码是foreach循环的声明

$cellIterator = $row->getCellIterator();
$cellIterator->setIterateOnlyExistingCells(false);
foreach ($cellIterator as $cell){  // <-- Breaks here
   // Do the Thing
}

以什么方式中断?您会遇到什么错误?您是否尝试过单元格迭代器的
valid()
方法?我不知道valid()方法,它是如何工作的?您可以查看代码以了解它是如何工作的,但它基本上只是检查行中当前单元格指针的位置是否小于或等于行中最高的列
Uncaught Error: Call to a member function isDataSet() on null in /PHPExcel/Classes/PHPExcel/Worksheet.php:1195