PHP error level collection_PHP tutorial
In many cases, our PHP files will have some errors that are very difficult to troubleshoot, such as outputting a large white page, and there is no way to fix the error. It is possible that PHP's error level blocks some non-fatal errors, resulting in no error prompts. Therefore, understanding and becoming familiar with PHP error levels may become a new method for debugging.
Error reporting level in php.ini By default, the PHP error reporting level is E_NOTICE. E_ALL means to report all non-fatal errors, because these errors may cause big problems (such as using undefined variables).
Shows all errors except alerts and coding standardization warnings.
Error reports are bit fields. You can add up the numbers to get the desired level of error reporting.
E_ALL - all errors and warnings (excluding E_STRICT)
E_ERROR - Fatal runtime error
E_WARNING - runtime warning (non-fatal error)
E_PARSE - compile-time parsing error
E_NOTICE - Runtime reminders (these are often caused by bugs in your code, or may be caused by intentional behavior.)
E_STRICT - Encoding standardization warning, allowing PHP to recommend how to modify the code to ensure optimal interoperability and forward compatibility.
E_CORE_ERROR - Fatal error during initialization during PHP startup
E_CORE_WARNING - Warning during initialization process when PHP starts (non-fatal error)
E_COMPILE_ERROR - Fatal compile-time error
E_COMPILE_WARNING - compile-time warning (non-fatal error)
E_USER_ERROR - User-defined error message
E_USER_WARNING - User-defined warning message
E_USER_NOTICE - User-defined reminder message
If set to: E_ALL | E_STRICT, it means recording all error information, which may cause a lot of error codes to appear on the website; but it should be said to be a good thing for programmers, who can optimize the code to the best; some Although non-fatal errors do not affect the operation of the program, they will increase the burden on PHP, usually increasing the burden on the website process (such as the application pool of IIS).
Tweak error reporting in PHP
Once PHP is set up to display what errors occur, you may want to adjust the level of error reporting. A PHP installation as a whole or as a stand-alone script can be set up to report or ignore different error levels. Table 7-1 lists most levels, but they generally fall into one of three categories:
l Note (notice), this will not prevent the execution of the script and may not necessarily be a problem;
l Warning, which indicates a problem but does not prevent the execution of the script;
l Errors, which prevent the script from continuing (including common parsing errors, which essentially prevent the script from running).
Table 7-1 PHP error reporting settings, used with the error_reporting() function, or in the php.ini file. Note that the value of E_ALL is different from older versions of PHP and does not include E_STRICT (but exists in PHP 6)
编 号 | 常 量 | 报 告 |
1 | E_ERROR | 致命的运行时错误(它会阻止脚本的执行) |
2 | E_WARNING | 运行时警告(非致命的错误) |
编 号 | 常 量 | 报 告 |
4 | E_PARSE | 解析错误 |
8 | E_NOTICE | 注意(事情可能是或者可能不是一个问题) |
256 | E_USER_ERROR | 用户生成的错误消息,由trigger_error()函数生成 |
512 | E_USER_WARNING | 用户生成的警告,由trigger_error()函数生成 |
1024 | E_USER_NOTICE | 用户生成的注意,由trigger_error()函数生成 |
2048 | E_STRICT | 关于兼容性和互操作性的建议 |
8191 | E_ALL | 所有的错误、警告和建议 |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

In PHP8, match expressions are a new control structure that returns different results based on the value of the expression. 1) It is similar to a switch statement, but returns a value instead of an execution statement block. 2) The match expression is strictly compared (===), which improves security. 3) It avoids possible break omissions in switch statements and enhances the simplicity and readability of the code.

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.
