Skip to content

Instantly share code, notes, and snippets.

@evaldosantos
Created January 25, 2013 20:17
Show Gist options
  • Select an option

  • Save evaldosantos/4637477 to your computer and use it in GitHub Desktop.

Select an option

Save evaldosantos/4637477 to your computer and use it in GitHub Desktop.
header("Content-type: text/csv");
header("Cache-Control: no-store, no-cache");
header('Content-Disposition: attachment; filename="filename.csv"');
$outstream = fopen("php://output",'w');
$test_data = $this->declarante_model->teste();
foreach( $test_data as $row ){
fputcsv($outstream, $row, ';', '"');
}
fclose($outstream);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment