• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Debug Bar getting in the way

#1
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
Reply

#2
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
Practical CodeIgniter 3  • CodeIgniter 4 Foundations - Coming Soon • Vulcan - CLI Tools for CI4
Reply

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

in Config/Boot/development.php turns it off. 
Simpler is always better
Reply

#4
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.
Practical CodeIgniter 3  • CodeIgniter 4 Foundations - Coming Soon • Vulcan - CLI Tools for CI4
Reply

#5
Is it much of a job to load the toolbar CSS script in the header to prevent HTML validation errors?
CI4 - Playground:
    https://www.john-betong.tk/test/1/42
CI 3.15  -  AmpProject 
     http://tools.pingdom.com/fpt/#!/uC1KU/ww...-jokes.com

Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.