PHPExcel致命错误GarbageCollect()

美好的一天,我试图从我的表格导出数据,以优秀的PHPExcel 1.8 。 这是我的脚本到目前为止:

 $this->load->library('excels'); $objPHPExcel = new PHPExcel(); $objPHPExcel->getProperties()->setTitle("export")->setDescription("none"); $objPHPExcel->setActiveSheetIndex(0); $query = $this->db->query("SELECT * FROM RESIGN"); $fields = $query->list_fields(); $col = 0; foreach ($fields as $field) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, 1, $field); $col++; } $row = 2; foreach($query->result() as $data) { $col = 0; foreach ($fields as $field) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row, $data->$field); $col++; } $row++; } $objPHPExcel->setActiveSheetIndex(0); $objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5'); header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="Products_'.date('dMy').'.xls"'); header('Cache-Control: max-age=0'); $objWriter->save('php://output'); 

当我运行该function。 Excel文件将被下载,在Excel文件里面我收到这个错误。

<b>Fatal error</b>: Call to a member function garbageCollect() on null in <b>D:\xampp\htdocs\payroll\application\third_party\PHPExcel\Writer\Excel5.php</b> on line <b>115</b><br />