PHP Tutorial PHP Blank page reasons and workarounds, PHP blank page _php Tutorial

Source: Internet
Author: User
Tags php syntax error blank page

PHP Tutorial PHP Blank page reasons and solutions, PHP blank page

A summary of the causes and workarounds for blank pages in PHP.

Many programmers in the development of PHP have encountered the appearance of blank pages, comprehensive analysis, in PHP Programming in a blank page 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, perhaps the code is legitimate and formal, but it is not expected to work. This is mentioned in many PHP tutorials.
Why is it? Perhaps the writer does not want to be comprehensive, after all, people are human, computer is a computer, the computer can not completely follow the people's thinking to run the script.
A good debugging method is to use the annotation "/* * * * *", commented out some code, observe the operation, so as to eliminate the error one by one, and finally find the location of the error code. In this case, to completely eliminate the logic error, no patience is not possible, so to calm down, do not worry.

2. Behavior not defined

  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"//>

If the $action variable is empty, set it to 1 and then determine 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 will PHP do? The answer is--nothing is done, so a blank page is created. Knowing the reason, the solution is easy.

The solution to this problem is simple, add an else after the If module, you can print some information.

3. Syntax error
If there is a syntax error, there is usually an error, how can it be blank? (Script Academy
Of course, this is only some of the individual phenomena, in some of the homepage space, if you write PHP syntax error, it will not have any hint.

Before uploading the file, test it locally and find out the wrong code to correct it.

4. Misuse of the error mask @
The error suppressor "@" is often used in places where errors may occur, but the use of the suppressors is too much or is not a good time to use, and can also cause whitespace to avoid appearing, take a look at the following two PHP scripts:

  php@include("test2.php"); Echo ($var);? >


  PHP$var// This line of code has errors, no semicolons $var 1// Ibid ?>

Run the test1 look, and the result is a blank page. Correcting is also simple, you can remove the suppressors in front of the include function, or correct errors in the test2.php file.

A blank page appears in PHP

Both print when the blank page has the wrong PHP file plus:
will display: Error, Note, warning and other information

PHP Blank Page Questions everyone

Because there is no output
To ask no output difficult to answer true techarticle PHP Tutorial php Blank page reasons and solutions, PHP blank page in PHP, the reason for blank pages and the solution summary. Many programmers have encountered gaps in PHP development ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.