PHP warn, notice problem solution
First of all, this is not a mistake, it is warning. Therefore, if the server cannot be changed, each variable should be defined before use.
Method 1: Server configuration Modifications
Modify the php.ini configuration file, error_reporting = E_all & ~e_notice
Method 2: Initialize the variables, standardize the writing (more cumbersome, because there are a lot of variables). But have not found a good definition method, I hope you advise
Method 3: Each file header plus: error_reporting (0); If not, only open php.ini, find display_errors, set to Display_errors = Off. Any future errors will not be prompted. Ini_set ("Display_errors", 0);
Method 4: Make a judgment:
Isset ($_get["page"])
?
??? If-else judgment
or add ' @ ' to indicate this line if there is an error or warning do not output
Such as:
@ $page =$_get["page"]
?
Method 5:
?
The file1.php file pays a value for the $XX variable, which is passed to file2.php by post.
If the file2.php does not have the definition of $xx, the direct use of $yy= $xx; The system will be error: "Undifined variaable $xx", if file2.php's files start with $xx= ""; definition, then file1.php $xx value will not pass!
?
File2.php can do that.
if (!isset ($xx)) $xx = "";