10 articles about the phptrigger_error () function are recommended.

Source: Internet
Author: User
In some PHP built-in functions (such as mkdir), add @ to the front to block the errors thrown by the function. how can we implement the UDF? I tried thrownewException and trigger_error. they cannot be blocked by @. note: Yes. for example, I want to write a JsonFile: get () method, if the file does not exist, an error is thrown, the path is invalid, or the decoding fails. if the file does not exist, an error is thrown, and false is returned. when users care about the error information, they can capture and process it themselves ;... in some PHP built-in functions (such as mkdir), add @ to the front to block the errors thrown by the function. how can we implement the UDF? I tried throw new Exception and trigger_error, but they cannot be blocked by @. note: for example, I want to write a JsonFile: get () method, if the object does not exist, an error is thrown, the path is invalid, or the decoding fails. if the object does not exist, the error is returned. if the object does not exist, the system automatically captures and processes the error message; if you do not care about the error message and only want to get the file content or false (failed), you can call the file by @ JsonFile: get () for convenience. How can I implement such a custom method (or function? Or do I have a bad idea? Is there a convenient and reasonable implementation method?

1. how to implement a custom function in PHP without throwing an error when @ is included?

Introduction: in some PHP built-in functions (such as mkdir), add @ to the front to block the errors thrown by the function. how can we implement the UDF? I tried throw new Exception and trigger_error, but they cannot be blocked by @. note: Yes, for example, I want to write...

2. Why does echo realpath (RUNTIME_PATH); in the same method produce different results?

Introduction: to enable custom error and exception handling mechanisms to capture fatal errors, trigger_error ($ e ['message']) is added to the fatalError () method of thinkphp. {code ...} {code ...} the following is your own error mechanism {code ...}

3. PHP Error Handling API method summary md

Summary: PHP Error Handling API method summary md: Currently, the number of Apis is 12. create (4) trigger_error-create a user-defined Error message, it is used to trigger an error message under the conditions specified by the user. It is used together with the built-in error processor. It can also be used with user-defined functions created by the set_error_handler () function to use the user_error-trigger_error alias set_error_handler-set user-defined error handler functions, replace the built-in error processor set_ex

4. PHP custom error handling function trigger_error () _ PHP Tutorial

Introduction: PHP custom error handling function trigger_error (). Define and use the trigger_error () function to create user-defined error messages. Trigger_error () is used to trigger an error message under the conditions specified by the user. It works with built-in Error Processor 1

5. how to use the PHP rmdir () function to delete a directory _ PHP Tutorial

Introduction: how to use the PHP rmdir () function to delete directories. PHP rmdir () function code :? Php functionremoveDir ($ dirName) {$ result = false; if (! Is_dir ($ dirName) {trigger_error (directory name error, E_USER_ERROR);} $ handle = opendir

6. trigger_error in PHP: PHP error example _ PHP Tutorial

Introduction: trigger_error in PHP triggers a PHP error example. Trigger_error in PHP: trigger_error trigger PHP error example. This article introduces the error blocker @ and trigger_error trigger

7. example of triggering PHP errors through trigger_error in PHP: trigger_errorphp_PHP tutorial

Introduction: trigger_errorphp is an example of a PHP error triggered by trigger_error in PHP. In PHP, trigger_error is used to trigger a PHP error example. in trigger_errorphp, trigger_error is used to trigger a PHP error example [error blocker @] except for error_reporting and displ in PHP. ini.

8. how to use trigger_error to display custom exception information?

Introduction: how can trigger_error be used to display custom error messages? PHP code

9. php simple code for pagination of numbers

Brief introduction: php simple code for pagination of numbers

10. how to use the PHP rmdir () function to delete a directory

Introduction: how to use the PHP rmdir () function to delete directories. PHP rmdir () function code :? Php functionremoveDir ($ dirName) {$ result = false; if (! Is_dir ($ dirName) {trigger_error (directory name error, E_USER_ERROR);} $ handle = opendir

[Related Q & A recommendations ]:

Php-why does echo realpath (RUNTIME_PATH); in the same method produce different results?

In PHP, how does a user-defined function not throw an error when @ is implemented?

The above is the article about php trigger_error () function. we recommend 10 articles in detail. For more information, see other related articles in the first PHP community!

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.