Files: think.class.php
PHP provides register_shutdown_function (), a function that can callback a registered function before the script terminates, that is, a function that executes when the PHP program executes.
The register_shutdown_function execution mechanism is: PHP calls the function to call into memory. Call this function when all the PHP statements on the page are completed. Note that the call from memory at this time is not called from the PHP page, so the above example cannot use a relative path, because PHP has already been used when the original page does not exist. There is no relative path to be made.
Note: register_shutdown_function is the function that is called after all PHP statements have been executed and not understood to be called when the client closes the streaming browser page.
You can understand the invocation condition this way:
1. When the page is forcibly stopped by the user
2. When the program code runs over time
3. When PHP code execution is complete, the code executes with exception and error, warning
The Set_error_handler () function sets the user-defined error-handling function.
This function is used to create the user's own error handling method during runtime.
The function returns the old error handler and returns null if it fails.
Grammar
Set_error_handler (Error_function,error_types)
Parameters |
Description |
Error_function |
Necessary. Specifies the function to run when an error occurs. |
Error_types |
Optional. Specifies the error reporting level at which user-defined errors are displayed. The default is "E_all". |
Hints and Notes
Tip: If you use this function, the standard PHP error handler is completely bypassed, and if necessary, the user-defined error handler must terminate (Die ()) script.
Note: If an error occurs before the script executes, the custom error handler is not used because the custom program is not registered at that time.
TP Framework Code Learning Learning record 3.2.3