Skip to content

Instantly share code, notes, and snippets.

@puiutucutu
Last active December 31, 2017 00:56
Show Gist options
  • Save puiutucutu/689697b476a823c98cd0ee5f4a4e318d to your computer and use it in GitHub Desktop.
Save puiutucutu/689697b476a823c98cd0ee5f4a4e318d to your computer and use it in GitHub Desktop.
Export csv from buffer
<?php
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment;Filename=spreadsheet.xls");
echo 'First Name' . "\t" . 'Last Name' . "\t" . 'Phone' . "\n";
echo 'John' . "\t" . 'Doe' . "\t" . '555-5555' . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment