PHPNotice: undefinedindex cause and solution. During php development, you may encounter an error message such as PHPNotice: undefinedindex. next I will introduce you to the solution to the undefinedindex error prompt. For example, $ _ GET [aa]; an error such as php Notice: undefined index may occur during PHP development, next I will introduce the solution to the undefined index error prompt.
For example, $ _ GET ['AA']; PHP Notice: undefined index 'AA' will appear.
The following is a summary of the PHP Notice: undefined index solution.
1. php. ini configuration file, error_reporting = E_ALL &~ E_NOTICE
2. add an isset function isset ($ _ GET ["page"]) if-else to judge
Another way is to customize a function so that you can directly use the function operation.
| The code is as follows: |
|
|
Function _ get ($ str ){
$ Val =! Empty ($ _ GET [$ str])? $ _ GET [$ str]: null;
Return $ val;
} |
Call method
_ Get ('str') instead of $ _ GET ['str ']
When Notice: undefined index error prompt, I will introduce the solution to the undefined index error prompt. For example, $ _ GET ['A']; then...