Many programmers in the development of PHP have encountered a blank page, comprehensive analysis, in PHP programming in the presence of blank pages may be caused by the following several reasons:
1. Logic Error
Logic errors are the hardest to rule out, and on the face of it, maybe the code is legal, formal, but not predictable. Why, then? Perhaps the writer is not comprehensive enough, after all, people are people, computers are computers, computers can not be completely according to People's thinking to run the script. Here, I tell you a better debugging method is to use the annotation symbol "* * *", comment out some code, observe the operation, in order to eliminate the error, and finally find the location of the error code. In this case to completely eliminate logic errors, no patience is not, so to calm down, do not worry.
2, the behavior is not defined
Look at the following code:
<?php
$action = $_get[' id '];
if ($action = = ")
$action = 1;
if ($action = = 1) {
echo ("/$action ' s value is 1");
} else if ($action = = 2) {
echo ("/$action ' s value is 2");
}
?>
This code is very clear, that is, if the $action variable is empty, set it to 1, and then judge the value of the $action variable to make a different event. Of course, if $action is neither equal to 1 nor equal to 2, what does PHP do? The answer is--nothing is going to happen, so there's a blank page. Knowing the reason, the solution is easy. The solution to this problem, very simple, in the If module after adding an else can be, print some information.
3. Grammatical errors
You may ask, if there is a grammatical error, the general will have the wrong hint, how can it be blank? Of course, this is only a few individual phenomena, in some home space, if you write PHP syntax errors, it will not have any hint. The solution is also very easy, before uploading the file in the local test, find the wrong code to correct.
4, misuse of the error screen character @
The error suppressor "@" is often used in places where errors can occur, but the use of a suppressor is too much or is not a good time, and can also cause white space to avoid it, to see the following two PHP scripts:
test1.php:
<?php
@include ("test2.php");
Echo ($var);
? >
test2.php:
<?php
$var = "Hi"//This line of code has errors, no semicolon
$var 1 = "Hello"//Ibid.
?>
Run the test1 to see, the result produces the blank page. Correcting is also very simple, you can remove the suppressors in front of the include function, or correct the errors in the test2.php file.