Home >PHP Framework >ThinkPHP >How to set error prompts in thinkphp5
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.
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?
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.
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.
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.
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.
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.
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.
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!