Trouble with debug bar? Solutions? |
I'm experiencing difficulties with returning JSON responses through AJAX due to the debug bar. Is there a solution to disable the debug bar specifically for certain controllers? Ideally, I'd like to disable it for individual routes or functions within a controller. Thank you!
Got my answer: I edited this file and adjust the $excludePaths property. Add your controller names (e.g., 'my_controller') within an array to exclude them from debug bar inclusion. Utilize dedicated route groups with custom middleware. Define a "no_debug" middleware that sets CI_DEBUG to false before calling your controller method. Apply this middleware to the desired routes. Disabling for Functions: Conditional Check: Inside your controller function, add a check: if(!is_cli()) define('CI_DEBUG', false); This disables debug only for web requests (not command-line). Here's the official CodeIgniter documentation link which i used on debugging and the toolbar configuration: https://stackoverflow.com/questions/omeglz/13562950/debugging-in-codeigniter-and-mvc
Yes, set urls in config/Filters.php, see docs
|
Welcome Guest, Not a member yet? Register Sign In |