Home >PHP Framework >ThinkPHP >How to set error prompts in thinkphp5

How to set error prompts in thinkphp5

藏色散人
藏色散人Original
2022-12-07 10:31:011987browse

How to set error prompts in thinkphp5: 1. Enter the public folder in the project root directory and open the index.php entry file; 2. View the comments on the debug mode switch; 3. Change the value of the "APP_DEBUG" constant Adjust it to true to display error messages.

How to set error prompts in thinkphp5

The operating environment of this tutorial: Windows 7 system, ThinkPHP version 5, Dell G3 computer.

How to set error prompts in thinkphp5? Why do thinkphp5 error messages appear?

How to set error prompts in thinkphp5

In the process of developing projects with thinkphp, by default no error message will be prompted on the page when an error is encountered. The following will teach you how to read the error message on the page. .

Methods/Steps

Open the browser and take a look. After encountering an error in thinkphp5, opening the page will prompt a page error! Please try again later. You cannot solve the problem without knowing the specific error message at this time.

How to set error prompts in thinkphp5

Go to the project directory, enter the public folder in the project root directory, you will see the index.php entry file, open the file.

How to set error prompts in thinkphp5

After opening index.php, you will see the comment about the debug mode switch. At this time, the value of the APP_DEBUG constant is false. This constant is the control error. Information prompt.

How to set error prompts in thinkphp5

Adjust the value of the APP_DEBUG constant to true and turn on the debugging mode. After turning on the debugging mode, the system will prompt an error message Show it.

How to set error prompts in thinkphp5

Open the browser and refresh the page again. You will see that the error message has appeared. You can accurately find the error location through the error message.

How to set error prompts in thinkphp5

The APP_DEBUG constant turns on the debugging mode during development, which helps to quickly solve the problems encountered. After the project is developed, turn off the APP_DEBUG debugging mode. , which will help improve project performance.

How to set error prompts in thinkphp5

Recommended study: "thinkPHP Video Tutorial"

The above is the detailed content of How to set error prompts in thinkphp5. 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