Home > Backend Development > PHP Tutorial > Causes and solutions of php blank page in php tutorial, php blank page_PHP tutorial

Causes and solutions of php blank page in php tutorial, php blank page_PHP tutorial

WBOY
Release: 2016-07-13 10:24:07
Original
1092 people have browsed it

php tutorial php blank page causes and solutions, php blank page

A summary of the causes and solutions for blank pages in php.

Many programmers have encountered blank pages when developing PHP. From a comprehensive analysis, the blank pages appearing in PHP programming may be caused by the following reasons:

1. Logical errors
Logical errors are the most difficult to eliminate. On the surface, the code may appear legal and regular, but when it runs, it is unexpected. This aspect is mentioned in many PHP tutorials.
Why? Maybe the writer didn't think comprehensively enough. After all, people are people and computers are computers. It is impossible for computers to run scripts completely according to human ideas.
A better debugging method is to use the comment symbols "/* */" to comment out some codes and observe the running conditions, so as to eliminate errors one by one and finally find the location of the error code. In this case, if you want to completely eliminate logical errors, you won't be able to do it without patience, so you have to calm down and don't be anxious.

2. Undefined behavior
Code:

<?<span>php
</span><span>$action</span> = <span>$_GET</span>['id'<span>];
</span><span>if</span>(<span>$action</span> == ''<span>)
</span><span>$action</span> = 1<span>;
</span><span>if</span>(<span>$action</span> == 1<span>) {
</span><span>echo</span>("/<span>$action</span>'s value is 1"<span>);
} </span><span>else</span> <span>if</span>(<span>$action</span> == 2<span>) {
</span><span>echo</span>("/<span>$action</span>'s value is 2"<span>);
} </span><span>//</span><span> www.jbxue.com</span>
?>
Copy after login

If the $action variable is empty, set it to 1, then determine the value of the $action variable and make different events. Of course, what will PHP do if $action is neither equal to 1 nor equal to 2? The answer is - nothing will be done, so a blank page will be generated. Once you know the cause, the solution is easy.

The solution to this problem is very simple. Just add an else after the if module and print some information.

3. Syntax error
If there is a grammatical error, there will usually be an error message. Why is it blank? (Script Academy www.jbxue.com)
Of course, this is just an individual phenomenon. In some homepage spaces, if you write PHP with grammatical errors, it will not give any prompts.

Solution:
Test locally before uploading the file to find out the wrong code and correct it.

4. Abuse of the error suppressor @
The error suppressor "@" is often used where errors may occur. However, if the suppressor is used too much or at the wrong time, it may also lead to blank spaces. Take a look at the following two PHP scripts:
test1.php:

<?<span>php
@</span><span>include</span>("test2.php"<span>);
</span><span>echo</span>(<span>$var</span><span>);
</span>?>
Copy after login

test2.php:

<?<span>php
</span><span>$var</span> = "Hi" <span>//</span><span>这行代码有错误,没有分号</span>
<span>$var1</span> = "Hello" <span>//</span><span>同上</span>
?>
Copy after login

Run test1 and see, the result is a blank page. Correction is also very simple. You can remove the suppressor in front of the include function, or correct the error in the test2.php file.

A blank page appears in php

Causes and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialProblemCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorial
Causes and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialBothCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialare printing Causes and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialblank pageCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialErrorCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialPHP fileCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialAdd above:
Causes and solutions of php blank page in php tutorial, php blank page_PHP tutorialWill display: Error, Note, Warning and other informationCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorial

PHP blank page problem Everyone

Because Causes and solutions of php blank page in php tutorial, php blank page_PHP tutorial has no outputCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorial
Causes and solutions of php blank page in php tutorial, php blank page_PHP tutorialI want to askCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialNo outputCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorial Causes and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorialHard to answerCauses and solutions of php blank page in php tutorial, php blank page_PHP tutorial

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/827938.htmlTechArticlephp tutorial php blank page causes and solutions, php blank page php blank page causes and solutions Summary of methods. Many programmers have encountered blank spaces when developing PHP...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template