开发者

PHP: Getting a blank page [duplicate]

This question already has answers here: How can I get useful error messages in PHP? (41 answers) Closed 5 years ago.

I am getting a blank page on a PHP when I use require_once to include another php. This is working, however, on other files. Now, I reduced all my code to this:

echo 开发者_Go百科'testing';
require_once 'C:/xampp/htdocs/folder/file.php';
echo 'now show this';

The code above just produces a blank page, no errors or anything, even though this file is being used on other files with no problems. I put a trace on the top of that file and nothing. I am using it in the same way the other files are using it, just a require_once.

If I comment file.php to nothing but a line reading echo ' - inside file', the line is displayed, however it is not continuing with the rest. Thus, showing the following output:

testing - inside file

It's not going with the rest... What could be the reason of this?


Try to enable error reporting on your page. That might shine a light on your problem.

Place this code in your page and let me know if you get any errors.

error_reporting(E_ALL);
ini_set('display_errors', '1');


Try checking for whitespace (spaces, new lines, or tabs) in front of opening php tags, and after closing php tags.

Check this for all of your files. I've had problems working with big frameworks and lots of files where a space around a tag would result in the blank screen, but not give feedback pointing to the issue, even with display_errors on and reporting set to E_ALL | E_STRICT

Edit: By 'check', I mean delete them if they are there. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜