CodeIgniter with PHPExcel fatal error cannot redeclare class IOFactory

后端 未结 3 434
情书的邮戳
情书的邮戳 2021-01-25 18:10

I\'m trying to use PHPExcel with CodeIgniter.

My problem is when i want to use this method below, I got PHP Fatal Error : Cannot redeclare class IOFactory

3条回答
  •  有刺的猬
    2021-01-25 18:53

    You could try this one and it works for me:

    $filePath = "uploads/import/test.xlx";                                  
    $this->load->library('PHPExcel');                         
    $objReader = new PHPExcel_Reader_Excel5();                        
    $objPHPExcel = $objReader->load($filePath);
    $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
    

提交回复
热议问题