我将 PhpOffice\PhpSpreadsheet 与 Apcu 缓存一起使用,并且出现此错误
错误:缓存中不再存在单元格条目 A1。这可能意味着缓存已被其他人清除。
$pool = new \Cache\Adapter\Apcu\ApcuCachePool();
$simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool);
\PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache);
$objReader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx");
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load(dirname(__FILE__).'/Tmpfile'.$i.'.xlsx');
$objPHPExcel->setActiveSheetIndex(0);
foreach ( $objPHPExcel->getActiveSheet()->getRowIterator() as $row ) {
if ( $row->getRowIndex() == 1 ){
$row->getCellIterator();
$cellIterator = $row->getCellIterator();
$cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set
$shop_row = array();
try {
foreach ($cellIterator as $key => $cell) { // <<<====== WHERE I got the ERROR
$key = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($key); ....
我没有任何想法来解决这个问题。
php 版本 7.1
phpOffice 1.5.2
5.1.17