Home  >  Article  >  Backend Development  >  How to use php error suppressor

How to use php error suppressor

coldplay.xixi
coldplay.xixiOriginal
2021-03-04 17:41:562380browse

How to use the error suppressor in php: First create a new [Error.php] file and declare the file type and encoding for PHP to interact with the browser; then use the error suppressor [@] and enter [if. .else...] statement as a judgment; finally run the web page, you can see that the error message of the MySql statement is not output.

How to use php error suppressor

The operating environment of this tutorial: Windows 7 system, PHP version 5.6, DELL G3 computer.

How to use error suppressors in php:

1. Create a new Error.php file, as shown in the figure:

How to use php error suppressor

2. Declare the file type and encoding for PHP interaction with the browser, as shown in the figure:

How to use php error suppressor

3. The meaning of the error suppressor (@):

How to use php error suppressor

4. Application scenario, connect to MySql database, as shown in the figure:

How to use php error suppressor

5. Enter if..else... statement is used as a judgment, as shown in the figure:

How to use php error suppressor

6. Run the web page and you can see that the error message of the MySql statement is not output. , only the information of the judgment statement is output, as shown in the figure:

How to use php error suppressor

## Related video recommendations:

PHP video Tutorial

The above is the detailed content of How to use php error suppressor. 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