file_get_contents returns an empty string that is 354 bytes long.

Posted by Kendall Crouch on Stack Overflow See other posts from Stack Overflow or by Kendall Crouch
Published on 2010-12-30T20:46:06Z Indexed on 2010/12/30 20:54 UTC
Read the original article Hit count: 172

Filed under:
|

I'm trying to read the contents of a file and simply getting an empty string. The file exists on the server.

I've tried some test with the following code and get the true to display:

$filename = "includes/blah.php";

$filecontents = file_get_contents($filename, FILE_USE_INCLUDE_PATH);

if ($filecontents === false) {

echo(":FALSE:");

}

else {

echo(":TRUE:");

}

var_dump($filecontents);

The dump displays "string(354)" which is the correct size of the file.

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about php

Related posts about file-get-contents