PHP Export CSV

Source: Internet
Author: User

1. There are many kinds of export, he has the export of the package, but if you want to export 7, 8,000 of the data is a bit difficult, I recently found an export can go to 10,000 of the data, as if only exported in CSV format.

Public Function Down_load ($lists) {

Set_time_limit (0);
Ini_set (' Memory_limit ', ' 1024M ');
$arr = Array (' A ', ' B ', ' C ', ' d ', ' e ', ' f ', ' g ', ' h ', ' I ', ' j ', ' K ', ' l ', ' m ', ' n ');
$data = ' serial number ';
foreach ($arr as $_arr) {
$data. = ', '. $_arr;
}
$data. = "\ n";
$i = 0;
foreach ($lists as $key = $_list) {
$i + +;
$data. = $i. ', '. $_list[' account '][0][' business_department ']
. ', '. $_list[' account '][0][' capital_platform ']. ", '. $_list[' account '][0][' account ']. ', '. $_list[' Currency_type ']. ' , '. $_list[' begin_y ']. ', '
. $_list[' Begin_b ']. ', '. $_list[' debit_y ']. ', '. $_list[' Debit_b ']. ', '. $_list[' credit_y ']. ', '
. $_list[' Credit_b ']. ', '. $_list[' end_y ']. ', '. $_list[' end_b ']. ', '. $_list[' year ']. ', '. ' ".", "." ".", "." \ n ";
}
Ob_end_flush ();
Header ("Content-type:text/csv");
Header ("Content-disposition:attachment;filename= Order Detail report. csv"); "Generate file name" = Custom
Header (' cache-control:must-revalidate,post-check=0,pre-check=0 ');
Header (' expires:0 ');
Header (' Pragma:public ');
Echo $data;
Exit
}

PHP Export CSV

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.