viernes, 12 de diciembre de 2025

Error reporting

<?php

// -------------------------------

// PHP Error Reporting Example

// -------------------------------


// Report all errors except user warnings and notices

error_reporting(E_ALL & ~E_USER_WARNING & ~E_USER_NOTICE);


// Display errors on screen (for development)

ini_set('display_errors', 1);


// Add a prefix to each error message

ini_set('error_prepend_string', '<strong>Error:</strong> ');


// Example errors

echo $undefined_variable;                 // Notice (ignored)

trigger_error("This is a warning", E_USER_WARNING);  // User warning (ignored)

trigger_error("This is an error", E_USER_ERROR);     // User error (shown with prefix)

?>

No hay comentarios:

Publicar un comentario