Home  >  Article  >  Backend Development  >  php ignore errors

php ignore errors

angryTom
angryTomOriginal
2019-10-17 15:32:576249browse

php ignore errors

php 3 ways to ignore errors:

1, @Shielding method

@ is a symbol that suppresses errors in PHP. Even if you enable the error reporting function, just add the @ symbol before the error statement to block the error message. Before using @ to suppress errors, a warning error will appear.

Sample code:

@$tcdi = $tcdian/$zdmoney;

2, error_reporting shielding method

Before starting the php file, we can add this sentence

error_reporting(0);

The meaning of this function is to set the error level of PHP and return the current level. 0 means disabling error reporting.

3. display_errors shielding method

This method should be the most thorough solution, because the first two methods can only act on a single line or a single file, while this one acts on all PHP files. Open the php.ini file and search for display_errors = on. The default should be on, which means the error reporting function is enabled. Just change it to off.

display_errors = off

For more PHP related knowledge, please visit PHP Chinese website!

The above is the detailed content of php ignore errors. For more information, please follow other related articles on the PHP Chinese website!

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