This problem occurs when you enable the error prompt in php, you will be notified of some programming errors. Next I will analyze the php Notice: Undefined index error prompt Method for you, for more information, see.
Cause Analysis
This problem is generally caused by undefined variables.
Example
The Code is as follows: |
Copy code |
If ($) { Echo $; } Else { } |
// Prompt: Notice: Undefined variable: a in E:/www/test. php on line 5
The Code is as follows: |
Copy code |
// Solution
$ A = 1; If ($) { Echo $; } Else { } // Output 1 // Add it to the header of the article Error_reporting (0 ); If ($) { Echo $; } Else { } |
Solution Summary
1. If a variable does not apply for a direct name, such as $ a = 1.
2. Add error_reporting (0) to the header of the article. No errors are prompted.
3. isset ($ _ GET ["page"]) or: @ $ page = $ _ GET ["page"]
4. Use error_reporting = E_ALL & ~ in php. ini &~ E_NOTICE can disable the display of notice, so it is good to block such warnings,