Home  >  Article  >  Backend Development  >  Implementation code for php exporting CSV files

Implementation code for php exporting CSV files

WBOY
WBOYOriginal
2016-07-25 08:56:18903browse
  1. // Pay attention to include the correct class path
  2. require_once(dirname(__FILE__) . '/export.php');
  3. $exceler= newJason_Excel_Export();
  4. // Generate excel format here Different formats are generated based on different suffix names.
  5. $exceler->setFileName('jason_excel.xls');
  6. // Generate csv format
  7. // $exceler->setFileName('jason_excel.csv');
  8. // Set excel title row
  9. $excel_title = array('First column', 'Second column', 'Third column');
  10. $exceler->setTitle($excel_title);
  11. // Set excel content
  12. $excel_data= array(
  13. array( '1', '2', '3'), // The first row
  14. array('1', '2', '3'), // The second row
  15. array('1', '2', '3'), // The third line
  16. );
  17. $exceler->setContent($excel_data);
  18. // Generate excel
  19. $exceler->export();
  20. ?>
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn