Home > Backend Development > PHP Tutorial > php export CSV file code

php export CSV file code

WBOY
Release: 2016-07-25 08:43:30
Original
954 people have browsed it
  1. // Pay attention here to include the correct class path
  2. require_once(dirname(__FILE__) . '/export.php');
  3. $exceler= newJason_Excel_Export();
  4. // Generate excel format Different formats are generated here 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

php, CSV


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template