The built-in function fputcsv in PHP can be used to print reports (Excel. If you do not have high requirements on the report format, fputcsv is a good choice. It has high execution efficiency and does not require a third-party library. it is easy to use. The above code will generate a csv file in the sheet, which can be opened in Excel. isn't it easy. If there are Chinese characters, it will be garbled when downloaded to the local machine after being executed in Linux, then the iconv function can be used for conversion. $ Listarray (); $ tm... PHP built-in function fputcsv can be used to print reports (Excel. If you do not have high requirements on the report format, fputcsv is a good choice. It has high execution efficiency and does not require a third-party library. it is easy to use. The above code will generate a csv file in the sheet, which can be opened in Excel. isn't it easy. If there are Chinese characters, it will be garbled when downloaded to the local machine after being executed in Linux, then the iconv function can be used for conversion. $ List = array (); $ tmp = "order number, order payment amount, lucky number, user name, user type, period, number generation time, award start time, award ID, award, bonus, remarks "; $ list [] = iconv ('utf-8', 'gb2312 // IGNORE ', $ tmp ); directly output the generated CSV file to the browser header ('content-Disposition:
1. 10 articles about the php fgetcsv () function are recommended.
Introduction: small issues encountered when writing csv files using the php fputcsv command (multi-dimensional array connector ). Command: fputcsv () command format: int fputcsv (resource handle [, array fields [, string delimiter [, string enclosure]) command parsing: fputcsv () pass a row (using the fields array
9. PHP exporting MySQL data to an Excel file (fputcsv) _ PHP Tutorial
Introduction: PHP exports MySQL data to an Excel file (fputcsv ). The method here is to use fputcsv to write a CSV file and directly output an Excel file to the browser. The code is as follows: // output the excelfile header, which can replace user.csv with the file name you want
10. php fputcsv () function csv data read/write database file code _ PHP Tutorial
Introduction: php fputcsv () function csv reads and writes database file code. Php Tutorial fputcsv () function csv data read/write database tutorial file code fputcsv () function is used to convert the data format to csv format for writing files or databases. 1. write strings to cs
[Related Q & A recommendations ]:
Php, fputcsv
The above is a detailed article about the php fputcsv () function. For more information, see other related articles in the first PHP community!