首页 > 解决方案 > 转换为 excel 时卡在 MySQL/MariaDB 占位符限制 - laravel 5.7

问题描述

我有这个查询来获取要转换为 Excel 的数组:

if($sfname=='ALL'){
$st_outlet_reg = Sfs::wherebetween('created', [$datefrom, $dateto])
                        ->when($cluster, function($query, $cluster) {
                        $query->where('cluster', $cluster);
                        })->get();
}

nomor = 0;
        foreach ($st_outlet_reg as $key => $value) {
      $nomor++;
            $i= $key+2;

            $sheet->cell('A'.$i, $sfname)->setFontSize('10');
            $sheet->cell('B'.$i, $value['outlet_id'])->setFontSize('10');
            $sheet->cell('C'.$i, $value['nama_outlet'])->setFontSize('10');
            $sheet->cell('D'.$i, $value['created'])->setFontSize('10');
            $sheet->cell('E'.$i, $value['msisdn'])->setFontSize('10');

            $sheet->cell('A'.$i, function($cell1) {
            $cell1->setBorder('thin', 'thin', 'thin', 'thin')->setAlignment('center');  });
            $sheet->cell('B'.$i, function($cell1) {
            $cell1->setBorder('thin', 'thin', 'thin', 'thin')->setAlignment('center');  });
            $sheet->cell('C'.$i, function($cell1) {
            $cell1->setBorder('thin', 'thin', 'thin', 'thin')->setAlignment('center');  });
            $sheet->cell('D'.$i, function($cell1) {
            $cell1->setBorder('thin', 'thin', 'thin', 'thin')->setAlignment('center');  });
            $sheet->cell('E'.$i, function($cell1) {
            $cell1->setBorder('thin', 'thin', 'thin', 'thin')->setAlignment('center');  });

        }

数组中的行数应该是 在此处输入图像描述

和 excel 下载结果只有 65k 行在此处输入图像描述

如何解决这个问题

标签: phplaravel

解决方案


推荐阅读