CodeIgniter Forums
Debug Bar getting in the way - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Debug Bar getting in the way (/showthread.php?tid=68675)



Debug Bar getting in the way - donpwinston - 08-11-2017

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";
    } 



RE: Debug Bar getting in the way - kilishan - 08-11-2017

I don't think it's possible to turn that off at the moment, actually. Would be a good thing for a pull request, though. Smile


RE: Debug Bar getting in the way - donpwinston - 08-11-2017

Looks like setting
define('CI_DEBUG', 0);

in Config/Boot/development.php turns it off. 


RE: Debug Bar getting in the way - kilishan - 08-11-2017

Oh - yeah, or you can turn it off in the filters config file, too. I was thinking you meant just turn it off for a single call. Nothing like that is implemented yet. Sorry for the confusion.


RE: Debug Bar getting in the way - John_Betong - 08-11-2017

Is it much of a job to load the toolbar CSS script in the header to prevent HTML validation errors?