Recently, the entire report task, the table must be exported every day to send mail to the administrator in Excel format, using Phpexcel to save the table to the server, and then send via Phpmailer OK.
Ob_end_clean ();
Ob_start ();
$objectPHPExcel = new Phpexcel ();
$objectPHPExcel->setactivesheetindex (0);
$objectPHPExcel->setactivesheetindex (0)->setcellvalue ("A$i", $resource->source_name);
$objectPHPExcel->setactivesheetindex (0)->setcellvalue ("b$i", $one);
$objectPHPExcel->setactivesheetindex (0)->setcellvalue ("c$i", $two);
$objectPHPExcel->setactivesheetindex (0)->setcellvalue ("d$i", $three);
$objectPHPExcel->setactivesheetindex (0)->setcellvalue ("e$i", $price);
$objectPHPExcel->setactivesheetindex (0)->setcellvalue ("F$i", $goods _price);
$objectPHPExcel->setactivesheetindex (0)->setcellvalue ("g$i", $product);
$objectPHPExcel->setactivesheetindex (0)->setcellvalue ("h$i", $count);
$filename = "C.xls";
$objWriter = Phpexcel_iofactory::createwriter ($objectPHPExcel, ' Excel5 ');
$objWriter->save ($filename);
Note that when you regenerate the generated Excel, the fopen permission error will appear when you generate it again . Help to the message, haha
Yii Phpexcel automatically generated files are saved to the server