When we first developed the project, we needed error prompts very much, but after the project went online, we certainly didn’t want to display these error prompts, right?This is about to do some settings, often a lot of PHP novice, do not know how to set?Or the setting method is wrong.
1、 The setting method of the project under development:
1. Open php.ini
2. Set error_ reporting = E_ ALL
3. Set display_ errors = On
2、 The setting method after the project is really online:
1. Open php.ini
2. Set error_ reporting = E_ ALL & ~ E_ DEPRECATED & ~ E_ STRICT
3. Set display_ errors = Off
3、 If you don’t have permission to modify php.ini, you can add the following two lines of code directly to the PHP file:
1、ini_ set(“display_ errors”, “On”);
2、error_ reporting(E_ ALL | E_ STRICT);
be careful:
First, after modifying the configuration file php.ini, be sure to restart the service.
Second, error_ The value of reporting can be modified at will. It is suggested to modify it according to your project development situation: is it under development?Or is it online?error_ What are the specific values of reporting?I’ll talk about it in the following expanded knowledge.
Expand knowledge:
Maybe some of them don’t understand the above settings. Let’s talk about it in detail: error_ Reporting represents the error level, display_ Errors represents whether error prompts are displayed.
error_ Reporting error levels include the following:
E_ All – all errors and warnings (including E_ STRICT)
E_ Error – fatal runtime error
E_ RECOVERABLE_ Error – a nearly fatal runtime error
E_ Warning – runtime warning (non fatal error)
E_ Parse – compile time parsing error
E_ Note – runtime notifications (these are usually warnings from errors in your code, but it may be intentional (for example, using uninitialized variables and relying on it to automatically initialize to a fact empty string)
E_ Strict – runtime notification that allows PHP to suggest changes to your code will ensure optimal interoperability and forward code compatibility
E_ CORE_ Error – fatal error during initial PHP startup
E_ CORE_ Warning – a warning (non fatal error) that occurs during PHP, initial startup
E_ COMPILE_ Error – fatal compile time error
E_ COMPILE_ Warning – compile time warning (non fatal error)
E_ USER_ Error – user generated error message
E_ USER_ Warning – user generated warning message
E_ USER_ Note – user generated notification message
E_ Suppressed – warning code will not work in future versions of PHP
E_ USER_ Suppressed – user generated discard warning
error_ The most common settings of reporting are as follows:
E_ All (displays all errors, warnings and notifications, including coding standards.)
E_ ALL & ~ E_ Note (show all errors except notification)
E_ ALL & ~ E_ NOTICE & ~ E_ Strict displays all errors except notification and coding standard warnings.)
E_ COMPILE_ ERROR|E_ RECOVERABLE_ ERROR|E_ ERROR|E_ CORE_ Error (display error only)
Read More:
- Visual studio 2017 can’t open, prompt this app can’t run on your PC
- Error prompt of MAPP opening PHP under Mac OS
- After Android studio is installed, open a pop-up window to prompt failed to load JVM DLL XXX
- Command prompt window prompt system error 5, access denied?
- Centos7 view and close firewall
- New user’s shell, delete prompt ^ H, up and down prompt ^ A ^ B, tab key is useless
- Solution to prompt resource error when opening DAZ studio
- Visual studio 2017, OpenGL program running prompt glut32.dll missing solution
- Java jar close startup script
- Prompt “namespace ‘app’ not bound” when compiling Android studio
- Prompt error: rpmdb open failed using yum
- [turn] right click to open the prompt [shellexecute failed (2): is this command correct? (fix)] with Notepad + +
- Android studio prompt: failed to instance one or more classes appcompattextview
- Docker service start, restart, close command
- Use yum to prompt Error: rpmdb open failed
- Vs error prompt: “unable to open source file XXXX. H” possible reasons and Solutions
- Solve Charles use 30 minutes to automatically close
- [solution] (transfer) win10 home edition, permanently close the update
- Manually control the display and close of datetimepicker in element
- close failed in file object destructor: IOError: [Error 10] No child processes