Return to Snippet

Revision: 38616
at January 5, 2011 23:50 by jrobinsonc

Initial Code
// funcion de errores personalizado
function nettuts_error_handler($number, $message, $file, $line, $vars){
	$email = "
		<p>An error ($number) occurred on line
		<strong>$line</strong> and in the <strong>file: $file.</strong>
		<p> $message </p>";

	$email .= "<pre>" . print_r($vars, 1) . "</pre>";

	$headers = 'Content-type: text/html; charset=iso-8859-1' . "

	// enviar log de errores a un Email
	error_log($email, 1, '[email protected]', $headers);

	// Si es un error demasiado critico, pararlo.
	if ( ($number !== E_NOTICE) && ($number < 2048) ) {
		die("There was an error. Please try again later.");

// declaramos cual sera la funcion que se ejecutara cuando ocurra un error

// realizando un error con una variable no existente
echo $somevarthatdoesnotexist;

Initial URL

Initial Description

Initial Title
Detectar errores con PHP y enviarlos por Email

Initial Tags

Initial Language