php csv auto download

Solutions on MaxInterview for php csv auto download by the best coders in the world

showing results for - "php csv auto download"
Renata
01 Mar 2018
1<?php
2header('Content-Type: text/csv');
3header('Content-Disposition: attachment; filename="sample.csv"');
4
5$list = array (
6    array('aaa', 'bbb', 'ccc', 'dddd'),
7    array('123', '456', '789'),
8    array('"aaa"', '"bbb"')
9);
10
11
12$fp = fopen('php://output', 'w');
13
14foreach ($list as $fields) {
15    fputcsv($fp, $fields);
16}
17
18fclose($fp);
19?>
queries leading to this page
php csv auto downloadphp csv auto download