Go PHP How to turn off the notice level error prompt

Source: Internet
Author: User

1. Change in php.ini file error_reporting
Switch

Error_reporting=e_all & ~e_notice


2. If you cannot manipulate the php.ini file, you can use the following methods
Add the following code to the page where you want to suppress the notice error prompt:


/* Report all errors except E_notice */
Error_reporting (E_all^e_notice);

--------------------------------------------------------------------------

The simplest way is to add the following code directly to the PHP program code:

The code is as follows:
Error_reporting (e_all^e_notice^e_warning);

  

You can turn off all notice and warning levels of errors.

Put this statement in your script's function include file, usually in config.php or conn.php to control the output.

Of course, I can also set the method in PHP.ini as follows

Open the php.ini file in the PHP installation directory

Find display_errors = on modified to Display_errors = Off

Note: If you have copied the php.ini file to the Windows directory, you must also change the Display_errors = on in C:windows/php.ini to Display_errors = Off

Resolution for display_errors = off invalidation in PHP. ini

Problem:

PHP settings file PHP. ini is already set display_errors = Off, but during the run, the error message appears on the Web page.

Solve:

Open the php.ini file in the PHP installation directory

Find log_errors = off modified to Log_errors = On

Find error_log = filename modified to error_log= "D:phperrlogphp_error.log" (Here's the directory and filename d:phperrlogphp_error.log whatever you take)

Note: If you have copied the php.ini file to the Windows directory, you must also put the C:windows/php.ini file.

In addition Php_error.log must have user's modify and write permission at least, otherwise cannot output error log.


Often see error_reporting (7) straight meaning: Set the level of error message return.

Value constant
1 E_error
2 e_warning
4 E_parse
8 E_notice
E_core_error
E_core_warning
E_compile_error
E_compile_warning
E_user_error
E_user_warning
1024x768 E_user_notice
2047 E_all
2048 e_strict

However 7=1+2+4
It's just a mistake. 1 e_error 2 e_warning 4 e_parse

The code is as follows:
<?php//Disable Error Reporting error_reporting (0);//Report Run-time error error_reporting (E_error | e_warning | E_parse);//Report All Errors error_reporting (E_all);? >

  

Go PHP How to turn off the notice level error prompt

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.