How to set error_reporting error reporting level in PHP
Error reporting level: Specifies under what circumstances errors in the script code (errors here are generalized errors, including E_NOTICE, E_WARNING, E_ERROR fatal errors, etc.) will be output in the form of an error report.
How to set the error reporting level:
1. Modify the PHP configuration file php.ini
After setting error_reporting in this way, restart the web server and it will take effect permanently.
Taking the xampp integrated software package as an example, open the configuration file php.ini and check the default value of error reporting level error_reporting, as follows:
error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT
means reporting all errors, But except for E_DEPRECATED and E_STRICT.
Modify it to:
error_reporting=E_ALL & ~E_NOTICE
means to report all errors except E_NOTICE. This is also the most commonly used error reporting level. It will not report errors of the attention class (such as using an undefined variable).
Save and it will take effect after restarting the web server.
2. Use the error_reporting() function
After setting in this way, it can take effect immediately. But only in the area behind the error_reporting() function call in the current script.
int error_reporting ([ int $level
] )
The parameter can be an integer or the corresponding constant identifier. It is recommended to use the constant form. The return value is the value (integer value) of the error reporting level in effect at the current location.
Here are some error reporting levels:
Value ’s ’ ’s ’ ’ s ‐ ‐ ‐ ‐ ‐‐‐‐ ‐ to report a fatal error that caused the script to terminate.
2 E_WARNING Report warning errors during runtime (the script will not terminate the run)
4 E_PARSE Report syntax parsing errors during compilation
8 E_NOTICE Report notification errors, scripts may generate errors32767 E_ALL Report all possible errors (different PHP versions, the value of the constant E_ALL will also May be different)
error_reporting(E_ALL ^ E_NOTICE); // Report all errors except E_NOTICE error_reporting(E_ERROR); // Only report fatal errorsecho error_reporting(E_ERROR | E_WARNING | E_NOTICE ); // Only E_ERROR, E_WARNING and E_NOTICE are reported.
Note: The default value of display_errors in the configuration file php.ini is On, which means error prompts are displayed. If set to Off, all error prompts will be turned off.The above introduces how to set the error_reporting error reporting level in PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

ThesecrettokeepingaPHP-poweredwebsiterunningsmoothlyunderheavyloadinvolvesseveralkeystrategies:1)ImplementopcodecachingwithOPcachetoreducescriptexecutiontime,2)UsedatabasequerycachingwithRedistolessendatabaseload,3)LeverageCDNslikeCloudflareforservin

You should care about DependencyInjection(DI) because it makes your code clearer and easier to maintain. 1) DI makes it more modular by decoupling classes, 2) improves the convenience of testing and code flexibility, 3) Use DI containers to manage complex dependencies, but pay attention to performance impact and circular dependencies, 4) The best practice is to rely on abstract interfaces to achieve loose coupling.

Yes,optimizingaPHPapplicationispossibleandessential.1)ImplementcachingusingAPCutoreducedatabaseload.2)Optimizedatabaseswithindexing,efficientqueries,andconnectionpooling.3)Enhancecodewithbuilt-infunctions,avoidingglobalvariables,andusingopcodecaching

ThekeystrategiestosignificantlyboostPHPapplicationperformanceare:1)UseopcodecachinglikeOPcachetoreduceexecutiontime,2)Optimizedatabaseinteractionswithpreparedstatementsandproperindexing,3)ConfigurewebserverslikeNginxwithPHP-FPMforbetterperformance,4)

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl


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

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version
Useful JavaScript development tools
