Home > Backend Development > PHP Problem > How many ways are there to close the page error message in PHP?

How many ways are there to close the page error message in PHP?

coldplay.xixi
Release: 2023-03-01 14:48:01
Original
2703 people have browsed it

How many ways are there to close the page error message in PHP?

#How many ways are there to close the page error message in PHP?

The ways for PHP to close the error prompts on the page are:

1. You can close all notice and warninglevel error.

Put this statement in the function include file of your script, usually config.php or conn.php to control the output. Of course, you can also set

in php.ini. The method is as follows:

1. Open the php.ini file in the PHP installation directory

2. Find display_errors=OnChange to display_errors=off

Note: If you have copied the PHP.ini file to the windows directory, you must also copy c:windows display_errors = On in /php.ini is changed to

display_errors=off

<br>

Problem:

PHP setting file php .ini has clearly been set display_errors=Off, but during operation, there will still be a message on the web page An error message appears.

Solution:

1. Open the php.ini file in the PHP installation directory

2. Find log_errors=off and change it to log_errors =on

3. Find error_log=filename and change it to error_log="D:PHPerrlogphp_error.log" (the directory and file name here are D:PHPerrlogphp_error .log (whatever you want)<br><br>

Note:

If you have copied the PHP.ini file to the windows directory, you must also needc: windows/php.ini file.

In additionphp_error.logMust have at least USER's modification and write permissions, otherwise the error log cannot be output.<br> <br>Frequently seenerror_reporting(7)Straight meaning: Set the level of error message reporting.

How many ways are there to close the page error message in PHP?

However, 7=1 2 4<br> is displayed when an error occurs

1 E_ERROR    2 E_WARNING      4 E_PARSE
Copy after login

The code is as follows:

<?php
//禁用错误报告  
error_reporting(0);  
//报告运行时错误  
error_reporting(E_ERROR | E_WARNING | E_PARSE);  
//报告所有错误  
error_reporting(E_ALL);  
?>
Copy after login

2. The easiest 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);
Copy after login

<br><br>

The above is the detailed content of How many ways are there to close the page error message in PHP?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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