Home  >  Article  >  Backend Development  >  Error level in php, php error level_PHP tutorial

Error level in php, php error level_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:44:30914browse

Error level in php, php error level

In the process of php programming, everyone will definitely encounter more or less error reminders, and it is these error reminders, To guide us in writing cleaner code, today we will first write down the main error types we listed, dig holes first, write relevant knowledge about PHP errors and exceptions, and slowly fill in the holes.

  • Deprecated lowest level error, program continues execution

  • Notice notification level error If undeclared variables are used directly, the program continues to execute

  • Warning warning level error, you may not get the desired results

  • Fatal error Fatal error Fatal error, the program will not execute further

  • Parse error syntax parsing error, the highest level error, even other error messages are not displayed

  • E_USER_ related errors User settings related errors

 Use the trigger_error() function to set a user-level error/warning/notice information

How to set the error level?

 error_reporting(-1) displays all errors, error_reporting(0) masks all errors. ini_set('error_reporting',0) also masks all errors. You can set error_reporting in the php.ini file to make the script display or not display certain errors. ini_set('display_errors','On') displays errors.

 Note: error_reporting() sets what kind of errors are reported, and ini_set('display_errors','On') sets whether errors are output. Thus error_reporting(-1) and ini_set('display_errors',0) can be used to set the log: errors are reported and not output.

 

Example: error_reporting(E_ALL&~E_NOTICE) does not display notification level errors. "~" means not.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1048774.htmlTechArticleError level in php, php error level In the process of php programming, everyone will encounter more or less Error reminders, it is these error reminders that guide us to write cleaner code...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn