This is what you would want to do on a development server to display errors
<?php
error_reporting(E_ALL);
?>
To temporarily shut this off
<?php
error_reporting(0);
?>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<?php
error_reporting(E_ALL);
$num1 = 1;
$num2 = 0;
function error_manage($num1, $num2)
{
if($num2 == 0)
{
throw new Exception("Can't divide by zero");
}
return true;
}
try
{
error_manage($num1, $num2);
echo "$num1 divided by $num2 is " . $num1/$num2;
}
catch(Exception $e)
{
echo "Error: " . $e->getMessage() . "<br>" . $e->getFile() . "<br>" . $e->getLine() . "<br>";
}
?>
I probably don't need to do this because most servers have error logs that I can look at.
No comments:
Post a Comment