Re: file_get_contents source code??
| From: | Wez Furlong | Date: | Fri, 19 Apr 2002 20:11:59 +0000 |
| Subject: | Re: file_get_contents source code?? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-83041@lists.php.net to get a copy of this message | ||
On 19/04/02, "Giovanni Lenzi" <grag@libero.it> wrote:
> Fatal error: Call to undefined function: file_get_contents() in
> /usr/home/s/a/sauzer/public_html/sfidario/readstreams/1.0/warsupcoming.php
> on line 17
file_get_contents is only in the current CVS (development) version of PHP.
> So i have to create myself this function.
>
> Can anyone help me please??
> Does anyone have the full source code of this function??
in your PHP script:
function file_get_contents($filename) {
$fp = fopen($filename, "rb");
if (!is_resource($fp))
return false;
$data = fread($fp, filesize($filename));
fclose($fp);
return $data;
}
In the future, please read the manual on php.net, as there are examples
in the user-contributed notes for this and similar functions (like file()),
that will help you.
This mailing list of the for development of PHP, not for writing scripts
with PHP: you would be better off with php-users or php-general or something
like that.
--Wez.