PHPExcel生成excel

include ‘statics/PHPExcel/PHPExcel.php‘;
            include ‘statics/PHPExcel/PHPExcel/Writer/Excel5.php‘;
            $objPHPExcel = new PHPExcel();
            ini_set("memory_limit", "1024M"); // 设置php可使用内存
            set_time_limit(0); 
            $objPHPExcel->getProperties()->setCreator($nickname)
                               ->setLastModifiedBy($nickname)
                               ->setTitle("数据EXCEL导出")
                               ->setSubject("数据EXCEL导出")
                               ->setDescription("备份查询数据")
                               ->setKeywords("excel")
                              ->setCategory("result file");
            $objPHPExcel->getActiveSheet()->setCellValue(‘A1‘, ‘日期‘);
            $objPHPExcel->getActiveSheet()->setCellValue(‘B1‘, ‘反馈数量‘);
            $objPHPExcel->getActiveSheet()->setCellValue(‘C1‘, ‘反馈人数‘);
            /*$objPHPExcel->getActiveSheet()->setCellValue(‘Z1‘, ‘来源页URL‘);*/
            if($feed){
                $i=2;
                foreach ($feed as $key => $v) {
                    $objPHPExcel->getActiveSheet()->setCellValue(‘A‘.$i,$tim[$key]);
                    $objPHPExcel->getActiveSheet()->setCellValue(‘B‘.$i,$v);
                    $objPHPExcel->getActiveSheet()->setCellValue(‘C‘.$i,$num[$key]);
                    $i++;
                }
            
                $objPHPExcel->getActiveSheet()->setTitle(‘反馈统计表‘);//重命名工作表
                $objPHPExcel->setActiveSheetIndex(0);//设置打开excel时显示的工作表
                $callStartTime = microtime(true);
                $filename=‘PDT‘.(date(‘Y-m-d,H:i:s‘));
                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‘);

 PHPExcel类库下载地址:https://www.php.cn/xiazai/leiku/1491