search
HomeBackend DevelopmentPHP ProblemHow to close error prompts in php
How to close error prompts in phpAug 05, 2020 am 10:23 AM
Error message

php method to turn off error prompts: 1. Add the code "error_reporting(E_ALL^E_NOTICE^E_WARNING);" to the php program code; 2. Modify the content of the "php.ini" file to "display_errors=off ".

How to close error prompts in php

Recommended: "PHP Video Tutorial"

How to close PHP error prompts

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);

You can turn off all notice and warning level errors.

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

Of course I can also set it in php.ini as follows

Open the php.ini file in the PHP installation directory

Find display_errors = On and change it to display_errors = off

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

Solution to the failure of display_errors = Off in PHP .ini

Problem:

PHP setting file php.ini has clearly set display_errors = Off, but during the running process, it still appears on the web page error message.

Solution:

Open the php.ini file in the PHP installation directory

Find log_errors = off and modify it to log_errors = on

Find error_log = filename and modify it For error_log="D:PHPerrlogphp_error.log" (the directory and file name here D:PHPerrlogphp_error.log are whatever you choose)

Note: If you have copied the PHP.ini file to the windows directory, then The c:windows/php.ini file must be deleted at the same time.

In addition, php_error.log must have at least USER's modification and write permissions, otherwise the error log cannot be output.

I often see error_reporting (7 ) means: Set the level of error message reporting.

value   constant   
  1   E_ERROR     
  2   E_WARNING     
  4   E_PARSE     
  8   E_NOTICE     
  16   E_CORE_ERROR     
  32   E_CORE_WARNING     
  64   E_COMPILE_ERROR     
  128   E_COMPILE_WARNING     
  256   E_USER_ERROR     
  512   E_USER_WARNING     
  1024   E_USER_NOTICE     
  2047   E_ALL     
  2048   E_STRICT

However, 7=1 2 4

means that when an error occurs, 1 E_ERROR 2 E_WARNING 4 E_PARSE

is displayed. The code is as follows:

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

The above is the detailed content of How to close error prompts in php. 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
解决win10“仅收集一些错误信息”的提示问题解决win10“仅收集一些错误信息”的提示问题Jan 13, 2024 pm 11:24 PM

win10提示“我们只收集某些错误信息”怎么解决呢?许多用户都表示感到束手无策,难道真的就没办法解决了吗?No,今天小编就来为大家献上解决win10提示“我们只收集某些错误信息”的方法,希望对你有所帮助。随着电脑的普及,现如今,基本上每家每户都有一台甚至更多的电脑。电脑的出现确实给我们带来了极大的方便,但是也给我们带来了很多麻烦,比如有的时候会出现提示“我们只收集某些错误信息”,这是怎么回事呢,该如何解决呢?今天小编就给大家说说该问题的解决方法。方法一1,敲击键盘上的“win+R”组合键,打开运

如何解决PHP中的常见问题:语法错误和警告如何解决PHP中的常见问题:语法错误和警告Jun 11, 2023 pm 04:13 PM

PHP是一种广泛使用的服务器端编程语言,常用于构建动态网页。然而,在编写PHP脚本时,常常会遇到各种语法错误和警告。这些错误和警告可能导致代码无法正常运行或者出现问题,因此解决这些问题是非常重要的。本文将介绍PHP中的常见问题:语法错误和警告,并提供如何解决这些问题的有效方法。语法错误当在PHP中编写脚本时,语法错误是非常常见的问题。语法错误可能是由以下原因

Win7应用windows系统评估工具提示出错该怎么办?Win7应用windows系统评估工具提示出错该怎么办?Jul 15, 2023 am 09:45 AM

近期有Win7系统客户在应用系统内置的感受指数值评估工具评估系统运作情况的历程中,“windows系统评估工具”出错而且弹出来“windows系统评估工具已停止工作”不正确对话框,导致没法对系统开展评估,这应当怎么解决呢?下边小编就给各位介绍一下Win7应用windows系统评估工具提示出错的解决方案。Win7应用windows系统评估工具提示出错解决方案1、大家按下“Win+R”键盘快捷键开启运行窗口后键入“%USERPROFILE%\AppData\Roaming\Microsoft\Tem

您的连接不是私密连接- 谷歌隐私设置错误您的连接不是私密连接- 谷歌隐私设置错误Feb 25, 2024 pm 03:42 PM

谷歌隐私设置错误:您的连接不是私密连接近年来,随着人们对个人隐私的关注不断增强,各大科技巨头都在努力改进其隐私保护措施。然而,就在不久前,有用户发现谷歌的隐私设置出现了错误,导致其连接不再是私密的。随着互联网的普及,我们越来越多地将个人信息存储在云端,通过网络进行各种交流和操作。作为全球最大的搜索引擎之一,谷歌接收和处理了大量的用户数据。为了保护用户的隐私,

如何实现在线答题中的答题错误提示功能如何实现在线答题中的答题错误提示功能Sep 24, 2023 am 11:21 AM

如何实现在线答题中的答题错误提示功能在线答题已成为现代教育的重要组成部分,通过互联网技术实现对学生的测验和考试。而即使在选择题中,学生仍然有可能做错题。为了帮助学生更好地理解和纠正错误,我们可以利用编程技术添加一个答题错误提示功能。本文将介绍如何使用HTML、CSS和JavaScript实现这一功能,并提供具体的代码示例。首先,我们需要一个HTML表单来展示

解决PHP会话并发超过限制错误并生成对应报错提示的方法解决PHP会话并发超过限制错误并生成对应报错提示的方法Aug 06, 2023 pm 09:17 PM

解决PHP会话并发超过限制错误并生成对应报错提示的方法在PHP开发中,会话(Session)是一个非常重要的概念,它用于跟踪用户的状态和数据。然而,如果会话并发超过限制,就会产生错误,影响用户体验和系统的稳定性。本文将介绍如何解决PHP会话并发超过限制错误,并生成对应的报错提示。一、了解会话并发限制在PHP中,会话并发限制是通过session.save_ha

如何在Rebet框架中使用表单验证和错误提示?如何在Rebet框架中使用表单验证和错误提示?Jun 03, 2023 am 09:10 AM

Rebet是一个基于PHP的轻量级Web应用框架,其提供了很多的功能以便于开发者快速开发高性能的Web应用程序。其中,表单验证和错误提示是Web应用程序开发中一个重要的环节,也是Rebet框架提供的功能之一。表单验证和错误提示,主要用于验证用户提交的表单数据是否符合要求,并及时告知用户错误信息,以便用户修正错误信息并重新提交。Rebet框架提供了表单验证和错

PHP表单处理:表单数据校验与错误提示PHP表单处理:表单数据校验与错误提示Aug 07, 2023 pm 04:17 PM

PHP表单处理:表单数据校验与错误提示前言在开发Web应用程序时,表单是不可或缺的组成部分。用户通过表单向服务器提交数据,而服务器则负责接收、处理和存储这些数据。在表单处理过程中,表单数据的校验和错误提示是非常重要的,可以帮助确保用户提交的数据符合预期,提高系统的可用性和安全性。表单数据校验表单数据校验是指对用户提交的数据进行检查,以确保数据的合法性和完整性

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.