PHP Export the CSV file implementation code

Source: Internet
Author: User
  1. !--? php //Note include the correct classpath
  2. requ Ire_once (DirName (__file__). '/export.php ');
  3. $exceler = Newjason_excel_export ();
  4. //Generate Excel format here different formats are generated depending on the suffix name.
  5. $exceler->setfilename (' Jason_excel.xls ');
  6. //Generate CSV format
  7. //$exceler->setfilename (' jason_excel.csv ');
  8. //Set Excel header 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 '),//First line
  14. Arra Y (' 1 ', ' 2 ', ' 3 '),//second line
  15. array (' 1 ', ' 2 ', ' 3 '),//Third line
  16. );
  17. $exceler->setcontent ($excel _data);
  18. //Generate Excel
  19. $exceler->export ();
  20. ?
copy code
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.