PHP Error 和 Logging 函数
PHP Error 和 Logging 简介
error 和 logging 函数允许你对错误进行处理和记录。
error 函数允许用户定义错误处理规则,并修改记录错误的方式。
logging 函数允许用户对应用程序进行日志记录,并把日志消息发送到电子邮件、系统日志或其他的机器。
PHP Error 和 Logging 函数
PHP:指示支持该函数的最早的 PHP 版本。
函数 | 描述 | PHP |
---|---|---|
debug_backtrace() | 生成 backtrace。 | 4 |
debug_print_backtrace() | 输出 backtrace。 | 5 |
error_get_last() | 获得最后发生的错误。 | 5 |
error_log() | 向服务器错误记录、文件或远程目标发送一个错误。 | 4 |
error_reporting() | 规定报告哪个错误。 | 4 |
restore_error_handler() | 恢复之前的错误处理程序。 | 4 |
restore_exception_handler() | 恢复之前的异常处理程序。 | 5 |
set_error_handler() | 设置用户自定义的错误处理函数。 | 4 |
set_exception_handler() | 设置用户自定义的异常处理函数。 | 5 |
trigger_error() | 创建用户自定义的错误消息。 | 4 |
user_error() | trigger_error() 的别名。 |
4 |
1、 set_error_handler() 函数
定义和用法
set_error_handler() 函数设置用户自定义的错误处理函数。
该函数用于创建运行时期间的用户自己的错误处理方法。
该函数会返回旧的错误处理程序,若失败,则返回 null。
语法
set_error_handler(error_function,error_types)
参数 | 描述 |
---|---|
error_function | 必需。规定发生错误时运行的函数。 |
error_types | 可选。规定在哪个错误报告级别会显示用户定义的错误。默认是 "E_ALL"。 |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP is a popular web development language that has been used for a long time. The PDO (PHP Data Object) class integrated in PHP is a common way for us to interact with the database during the development of web applications. However, a problem that some PHP developers often encounter is that when using the PDO class to interact with the database, they receive an error like this: PHPFatalerror:CalltoundefinedmethodPDO::prep

Solve the "error:incompletetypeisnotallowed" problem in C++ code. During the C++ programming process, you sometimes encounter some compilation errors. One of the common errors is "error:incompletetypeisnotallowed". This error is usually caused by operating on an incomplete type. This article will explain the cause of this error and provide several solutions. firstly, I

It is very common to use axios in Vue applications. axios is a Promise-based HTTP client that can be used in browsers and Node.js. During the development process, the error message "Uncaught(inpromise)Error: Requestfailedwithstatuscode500" sometimes appears. For developers, this error message may be difficult to understand and solve. This article will explore this

Solution to "0271: real time clock error" that cannot boot: 1. Press F1, and in the interface that appears, move the option bar to the third item "Date/Time"; 2. Manually change the system time to the current one time; 3. Press F10 and select yes in the pop-up dialog box; 4. Re-open the notebook to boot normally.

Solve the "error:expectedinitializerbefore'datatype'" problem in C++ code. In C++ programming, sometimes we encounter some compilation errors when writing code. One of the common errors is "error:expectedinitializerbefore'datatype'". This error usually occurs in a variable declaration or function definition and may cause the program to fail to compile correctly or

Interpretation of MyBatis dynamic SQL tags: Detailed explanation of Set tag usage MyBatis is an excellent persistence layer framework. It provides a wealth of dynamic SQL tags and can flexibly construct database operation statements. Among them, the Set tag is used to generate the SET clause in the UPDATE statement, which is very commonly used in update operations. This article will explain in detail the usage of the Set tag in MyBatis and demonstrate its functionality through specific code examples. What is Set tag Set tag is used in MyBati

How to solve PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectory In the process of using PHP development, we often encounter some file operation problems, one of which is "PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectory"

When writing web applications using PHP, a MySQL database is often used to store data. PHP provides a way to interact with the MySQL database called MySQLi. However, sometimes when using MySQLi, you will encounter an error message, as shown below: PHPFatalerror:Calltoundefinedfunctionmysqli_connect() This error message means that PHP cannot find my
