Disable the Notice warning method in the default PHP settings. The default setting is notice.
The default setting of PHP is to display the Notice warning prompt, which will cause the page to fail to display normally. You can directly use undefined variables. However, PHP compilation is not as strict as C ++, which is often used in programming.
When I deploy my PHP program that I have worked hard to write on the server, I believe this reminds many people that:
PHP Notice: Undefined variable PHP Notice: Undefined index
Let's take a look. You can directly use undefined variables. However, PHP compilation is not as strict as C ++, which is often used in programming. The default setting of PHP is to display these prompts, which will cause the page to fail to display normally.
// Error_reporting (E_ALL); error_reporting (E_ALL | ~ E_NOTICE); // display all error messages except E_NOTICE
The first one is to show all the errors,
The second is to display all errors without warning,
We only need to add // in front of the second line and remove the // in front of the first line.
Appendix: detailed error reports
Usage:
Error_reporting (0); // Disable Error Report error_reporting (E_ALL ^ E_NOTICE); // display all error messages except E_NOTICE error_reporting (E_ALL ^ E_WARNING ^ E_NOTICE ); // display all error messages except E_WARNING E_NOTICE error_reporting (E_ERROR | E_WARNING | E_PARSE); // display runtime errors, which are the same as error_reporting (E_ALL ^ E_NOTICE. Error_reporting (E_ALL); // display all errors