Welcome Guest, Not a member yet? Register   Sign In
Trouble with debug bar? Solutions?
#1

(This post was last modified: 02-20-2024, 12:21 AM by MathewTamra.)

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

Yes, set urls in config/Filters.php, see docs
Simple CI 4 project for beginners codeigniter-expenses ( topic )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB