fork(4) download
  1. <?php
  2. function exportDataToXLSX()
  3. {
  4. require_once(dirname(__FILE__) . "/../Classes//PHPExcel.php");
  5. require_once(dirname(__FILE__) . "/../Classes/PHPExcel/Writer/Excel2007.php");
  6.  
  7. $outputFileName = 'so.xlsx'; //TODO hash pour le nom
  8. $outputFilePath = dirname(__FILE__) . '/so/' . $outputFileName;
  9. //$outputFilePath = 'so/' . $outputFileName;
  10. $outputFileType = 'Excel2007';
  11.  
  12. //Creates a PHPExcel object
  13. $objPHPExcel = new PHPExcel();
  14.  
  15. //– Les Données
  16. $objPHPExcel->setActiveSheetIndex(0);
  17. $activeSheet = $objPHPExcel->getActiveSheet();
  18. $activeSheet->setCellValueByColumnAndRow(1, 1, "Test");
  19.  
  20. //– On sauvegarde notre fichier (Format Excel 2007)
  21. $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
  22. $objWriter->save($outputFilePath);
  23.  
  24. header("Content-Disposition: attachment; filename=\"" . basename($outputFilePath) . "\"");
  25. header("Content-Type: application/force-download");
  26. header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet; charset=utf-8');
  27. header("Content-Length: " . filesize($outputFilePath));
  28. header("Connection: close");
  29.  
  30. @readfile($outputFilePath);
  31. exit();
  32. }
  33.  
  34. exportDataToXLSX();
  35. ?>
Runtime error #stdin #stdout #stderr 0.01s 20568KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Warning:  require_once(/home/XDQGUh/../Classes//PHPExcel.php): failed to open stream: No such file or directory in /home/XDQGUh/prog.php on line 4
PHP Fatal error:  require_once(): Failed opening required '/home/XDQGUh/../Classes//PHPExcel.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/XDQGUh/prog.php on line 4