Error Handling in PHP Simple Trick

Set error handler at beginning, write error handler function to track error . you can write one more function  to save error in error log file.  


//set error handler at beginning
set_error_handler("errorHandler ");

<?php


//error handler function
function errorHandler($errno, $errstr) 
{
echo "<b>Error Number :</b> $errno";
echo "<b>Error Message:</b> $errstr";
}



<Your error code here -start >
------
<Your error code here -End >


?>

No comments :

Post a Comment

Leave A Comment...