Tag:des io ar on file cti line sql br
1. Determine if the file exists,
File_exists ("file name") or Die ("No such file");
2, Set_error_hanlder ("Error handling function name", error constant);
Generally used to handle various errors in the system
This is a callback function that can invoke a custom error handler.
A custom function can accept at least two parameters with a maximum of five parameters,
Basic syntax:
Error_function (Error_level, Error_message, Error_file, Error_line, Error_context);
Cases:
<?php
function My_error ($errLevel, $errDescribe)//An error level, a description of the error
{
echo "Level:"
}
Set_error_hanlder ("Mysql_error", e_warning);
?>
3. Error Trigger
tend to handle logical errors,
<?php
if (age>30)
{
Trigger_error ("too old");
}
?>
4. Abnormal
Exceptions require the use of custom top-level exception handlers or Try-catch to handle
You can also customize the exception class to inherit extends Exception
<?php
Funcction my_exception ($exception)
{
echo "Top exception handler". $exception->getmessage ();
}
To modify the default top-level exception handling function
Set_exception_handler ("My_exception");
?>
[php]php error handling mechanism