note 44415 deleted from function.file-get-contents by tomsommer
| From: | tomsommer@php.net | Date: | Thu, 05 Aug 2004 09:07:26 +0000 |
| Subject: | note 44415 deleted from function.file-get-contents by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73991@lists.php.net to get a copy of this message | ||
Note Submitter: erik@phpcastle.com
----
When you want to get the file content from a file do it before you use the fopen ([file],
'w+') function. Otherwise you will get an empty string.
So:
<?php
$fc = file_get_contents ('file.txt');
echo $fc;
//echoes e.g. "This is just a text file..."
?>
<?php
$fo = fopen ('file.txt','w+');
$fc = file_get_contents ('file.txt');
echo $fc;
//echoes e.g. ""
?>
Maybe handy becouse this is a tricky part of the scripting ;-)