TP Framework Code Learning Learning record 3.2.3

Source: Internet
Author: User
Tags php error

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.