php - Laravel 3 create Text (CSV) file -
hello trying grab emails database, output them text (comma separated) file. here have done not work:
public function get_textfile() { $emails = staff::get('email'); header("content-type: text/csv"); header("cache-control: no-store, no-cache"); header('content-disposition: attachment; filename="filename.txt"'); $stream = fopen("php://output", 'w'); foreach($emails $email) { fputcsv($stream, $email, ','); } fclose($outstream); } return (something)?
getting this: error 6 (net::err_file_not_found): file or directory not found.
this route:
route::get('textfile', array('as' => 'textfile','uses' => 'admin@textfile'));
try file_put_contents($filename, implode(',', staff::get('email')));
Comments
Post a Comment