Home > Backend Development > PHP Tutorial > Introduction to php user_error() function

Introduction to php user_error() function

怪我咯
Release: 2023-03-13 12:20:01
Original
1902 people have browsed it

user_error() function creates a user-defined error message.

The user_error() function is used to trigger an error message under user-specified conditions. It can be used with the built-in error handler routine, or with a user custom function set by the set_error_handler() function.

This function is useful when you need to customize the error message under a specified condition when running the script.

If an illegal error type is specified, this function returns FALSE, otherwise it returns TRUE.

This function is an alias of the trigger_error() function.

Syntax

user_error(error_message,error_types)
Copy after login


Parameters Description
error_message Required. Specifies the error message. Length limit is 1024 characters.
error_types Optional. Specifies the error type of the error message.

Possible error types:

  • E_USER_ERROR - User-generated fatal error at runtime. Unrecoverable error. Stop executing the script.

  • E_USER_WARNING - User-generated non-fatal warning at runtime. The script did not stop executing.

  • E_USER_NOTICE - Default. User-generated runtime notifications. Script discovery can be a bug, but can also occur when the script is running normally.


The above is the detailed content of Introduction to php user_error() function. 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