Export CSV Using
If you need to send a CSV file directly from the browser, without writing in an external file, you can open the output and use fputcsv on it..
Utility function to output a mysql query to csv with the option to write to file or send back to the browser as a csv attachment.
Array Listing Create csv ::::
The above example will write the following to file.csv:
Must use header Before Export CSV File
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=your_desired_name.csv");
header("Pragma: no-cache");
header("Expires: 0")
Full Example Code :::
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=your_desired_name.csv");
header("Pragma: no-cache"); header("Expires: 0")
Required fields are marked *
Get all latest content delivered to your email free.