Re: File retrieval
| From: | Mark Cain | Date: | Sun, 03 Apr 2005 13:20:44 +0000 |
| Subject: | Re: File retrieval | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-39100@lists.php.net to get a copy of this message | ||
You could read this:
http://php.net/fread
or try this -- assuming that this is a non-windows OS:
<?php
// get contents of a file into a string
$filename = "/directory/pathto/data.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
?>
Mark Cain
----- Original Message -----
From: "Ron Piggott" <ron.php@actsministries.org>
To: "PHP DB" <php-db@lists.php.net>
Sent: Friday, April 01, 2005 11:43 PM
Subject: [PHP-DB] File retrieval
> If I have a file named
>
> "data.txt"
>
> Is it possible to load the contents of it into a variable search as
>
> $contents
>
> idealy I would like to know if I am able to do something like
>
> $contents = data.txt;
>
> Ron
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>