Solutions to some of the errors encountered in PHP development

Source: Internet
Author: User
This article mainly introduces the PHP development encountered in some of the wrong solution, has a certain reference value, now share to everyone, the need for friends can refer to

In the process of debugging the program development, we will always encounter a variety of error , part of the error impact of code execution, part of just give one WARNING or NOTICE , will not affect the following code to continue execution.

PHPAn error control operator is provided in which @ PHP any error information that may result from an expression is ignored until it is placed in an expression. If you want to control the type of output error, you can error_reporting() tell the compiler which error to report by using a function.

int error_reporting ([ int $level ] ): Set what errors should be reported PHP
$levelIs the error level, returns the old [error_reporting] level, or level returns the current level if the parameter is not given.

<?php//Close all PHP error reports error_reporting (0);//Report Simple running errorserror_reporting (E_error | e_warning | E_parse);//Report E_notice is also very good (report uninitialized variables or error spelling of capturing variable names) error_reporting (E_error | e_warning | E_parse | E_notice);//except E_notice, report all other errors error_reporting (e_all ^ e_notice);//Report All PHP errors (see Changelog) error_reporting (E_all) ;//Report All PHP error error_reporting (-1);//And Error_reporting (E_all); As Ini_set (' error_reporting ', e_all);? >

The Levels and constants of the errors are PHP defined in the predefined constants:

Where we are often encountered in the development of,, E_ERROR E_WARNING E_PARSE , E_NOTICE .

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

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.