08-11-2017, 08:01 AM
I have a controller that among other things downloads a csv file. But my downloaded file contains my data plus the debug bar html code! How do I get rid of this?
PHP Code:
public function download_names($rcseq)
{
$db = new \App\Libraries\NcrsEbnDb();
$rows = $db->getRCNames($rcseq);
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=names-$rcseq.csv");
ob_clean();
flush();
foreach ($rows as $row)
print $row['NAME'] . "\r\n";
}
Simpler is always better