Skip to content

Instantly share code, notes, and snippets.

Created April 17, 2014 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/11009177 to your computer and use it in GitHub Desktop.
Save anonymous/11009177 to your computer and use it in GitHub Desktop.
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=data.csv');
header('Pragma: no-cache');
$output = fopen('php://output', 'w');
fputcsv($output, $this->table_header);
foreach ($report_data as $key => $value) {
fputcsv($output, implode(',', $value));
}
fclose($output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment