CodeIgniter 4 tips

To prevent the debug toolbar from appearing for a certain controller method when in development mode, for example if you are generating a CSV file with code, edit app/Config/Filters.php and add the following

public function __construct()
  // hide debug toolbar when generating a CSV file
  if (strpos($_SERVER['REQUEST_URI'], 'export_csv')) unset($this->globals['after'][0]);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.