Home >Backend Development >PHP Tutorial >PHP Notice: undefined index causes and solutions_PHP tutorial
When developing PHP, you may encounter error messages such as PHP Notice: undefined index. Let me introduce to you the solution to the undefined index error message.
For example $_GET['aa']; PHP Notice: undefined index ‘aa‘ will appear.
Let me summarize the solutions to PHP Notice: undefined index.
1. php.ini configuration file, error_reporting = E_ALL & ~E_NOTICE
2. Add an isset function isset($_GET["page"]) if-else judgment
Another way is to customize a function, so that you can directly use the function operation
The code is as follows
|
Copy code
|
||||
function _get($str){ $val = !empty($_GET[$str]) ? $_GET[$str] : null; Return $val; |
}
www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632144.htmlTechArticleWhen developing PHP, you may encounter errors such as PHP Notice: undefined index. Let me tell you about it below. Introducing the solution to the undefined index error message. For example, $_GET['aa']; will...