Last active
December 24, 2015 00:29
-
-
Save ericcholis/6717291 to your computer and use it in GitHub Desktop.
Lithium CSV Media Handler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Media::type('csv', 'text/plain', array( | |
'encode' => function($data) { | |
ob_start(); | |
$out = fopen('php://output', 'w'); | |
foreach ($data as $record) { | |
fputcsv($out, $record); | |
} | |
fclose($out); | |
return ob_get_clean(); | |
} | |
)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment