您好我正在尝试使用Excel报告下载excel文件
我写了以下代码
$objPHPExcel = new PHPExcel();
foreach($cusRec as $arrayValue)
{
echo $arrayValue['branch'];
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('A2', $arrayValue['branch']);
$row++;
}
header('Content-Type: application/vnd.ms-excel');
header("Content-Disposition: attachment;Filename=$filename.xls");
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
数组中的数据采用以下格式
Array ( [0] => Array ( [cid] => 1 [branch] => NAGZIRI (UJJAIN) [custid] => 116018142)[1] => Array ( [cid] => 2 [branch] => NAGZIRI (UJJAIN) [custid] => 126189662 ))
当使用for循环和下载文件进行迭代时,它不会在下载的excel文件中显示任何数据。
如何删除此错误
由于