php ignore errors

angryTom
Release: 2023-02-27 07:58:01
Original
6327 people have browsed it

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;
Copy after login

2, error_reporting shielding method

Before starting the php file, we can add this sentence

error_reporting(0);
Copy after login

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
Copy after login

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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template