The above are PHP prompts rather than error reports. php can be directly used without declaring the variables in advance, but there will be prompts for not declaring the variables.
Solution:
1. Modify the error display mode of errror in PHP. ini.
Change error_reporting = e_all
Error_reporting J = e_all &~ E_notice
Restart the server.
2. Variable Initialization
3. Determine Variables
Isset ($ _ post ['']), empty ($ _ post ['']) If -- else
4. Add @ before the notice code, indicating that an error or warning is returned.
@$word = $_POST['word'];
5. Last Method
Define a function:
function _get($str){ $val = !empty($_GET[$str]) ? $_GET[$str] : null; return $val; }
You can call it every time, such as _ Get ('str') instead of $ _ Get ['str'].
[PHP-core-Error]
Error_reporting = e_all &~ E_notice
The error report level is the superposition of bit fields. We recommend that you use e_all | e_strict
; 1 e_error fatal runtime error
; 2 e_warning runtime warning (non-fatal error)
4. parsing error during e_parse Compilation
; 8 e_notice runtime reminder (often a bug or intentionally)
; 16 e_core_error fatal error during PHP startup
32 _ core_warning warning during initialization (non-fatal error) during PHP startup)
; 64 e_compile_error fatal error during compilation
; 128 e_compile_warning warning during compilation (non-fatal error)
256 User-Defined fatal error
; 512 user_warning User-Defined warning (non-fatal error)
1024 e_user_notice User-Defined notifications (often bugs, or intentionally)
; 2048 e_strict code standardization warning (how to modify to forward compatibility)
; 4096 e_recoverable_error is close to a fatal runtime error. If it is not captured, it is treated as e_error.
; 6143 all except e_strict errors (8191 in PhP6, that is, all errors)
Detailed source reference: http://www.jb51.net/article/30328.htm