Ec (2); & nbsp; when creating a website, you may frequently retrieve data lists. Users usually want to download the list data and store it on the client. Of course, a fixed format is required for downloading the data so that it can be viewed in Excel or other software. To put it simply, export data from CSVExcel. Note: the basic format of the output document is column 1, column 2, column 3, & hellip;. When formatting data with column nn, you must filter out special characters. For example, & ldquo script ec (2); script
When you create a website, you may frequently retrieve data lists. Users usually want to download the list data and store it on the client. Of course, a fixed format is required for downloading the data so that it can be viewed in Excel or other software. To put it simply, export CSV/Excel Data.
Note:
The basic format of the output document is: column 1, column 2, column 3 ,......, Column nn
When formatting data, you must filter out special characters. For example, if "," is not converted to full-width "," it will lead to confusion in the data format.
Implementation Method:
For example, you can search the database table, save the result as a string, filter the format and special characters, and export the result to the CSV file on the client.
OrderSearchEdit_saveCSV.php
Include ($ _ SERVER [''document _ root'']. "/ftcart/OrderInfoManager. class. php ");
Include ($ _ SERVER [''document _ root'']. "/ftcart/CommonUtil. php ");
Include ($ _ SERVER [''document _ root'']. "/ftcart/CommonConst. php ");
Include ($ _ SERVER [''document _ root'']. "/ftcart/CommonErrorMsg. php ");
Include ($ _ SERVER [''document _ root'']. "/webadmin. php ");
$ Searchcase = new OrderInfoManager ();
$ NowTime = microtime_float ();
$ Searchcase = unserialize ($ _ SESSION ["ORDER_SEARCH_CASE"]);
$ Listcsv = $ searchcase-> doCSV (); // call the doCSV () method
$ Filename = $ nowTime;
// $ Filename = str_replace (":", "", $ nowTime );
// $ Filename = trim ($ filename );
// Echo $ filename;
Header ("Content-Disposition: attachment; filename =". $ filename. ". csv ");
Header (''content-Type: APPLICATION/OCTET-STREAM '');
Echo "Note No., note day, name, domicile, Branch