1.

Explain Inhibitor and error handling in CodeIgnitor.

Answer»

LIKE every other framework, codeIgnitor let you build the error reporting, also error logging class permits errors and debugging messages to be saved as a text FILE.  

Following are the common error logging functions: 

  • show_error(‘message’ [, int $statuscode= 500 ] ) : This function displays the error message supplied to it using application/errors/errorgeneral.PHP 
  • show_404(‘page’ [, ‘logerror’]) : This function will show 404 messages supplied to it by template application/errors/error404.php.
  • log_message(‘level’, ‘message’):  This function ALLOWS you to write messages to your log files. Mandatory param is error level and the second parameter is a type of message (Debug, Error or Info). 

To enable error logging you MUST set the threshold for logging in application/config/config.php. Also, your logs directory must be writable.

$config['log_threshold'] = 1;

Inhibitor is an error handling class in CodeIgniter. It uses PHP ‘s native functions like register_shutdown_function, set_exception_handler, set_error_handler to handle parse errors, exceptions, and fatal errors.



Discussion

No Comment Found