Please take another look at the manual page on fopen(). You're not using it
correctly. fopen() does not return the contents of the file, it retuns a
resource handel. You pass the handel as a parameter to fread() in order to
read the file.
http://www.php.net/manual/en/function.fread.php
If all you want is to get the contents of a file into a variable then you
can use something like this:
$contents = implode('', file("myfile.txt"));
- Kevin
----- Original Message -----
From: "John Taylor-Johnston" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "John Taylor-Johnston" <[EMAIL PROTECTED]>
Sent: Wednesday, March 05, 2003 3:22 PM
Subject: [PHP] fopen
> #http://www.php.net/manual/en/function.fopen.php
>
> $contents = fopen ("/home/pathto/file.txt", "r");
>
> if ($contents){echo"<textarea>$contents</textarea>";}
> else{echo "no contents there";}
>
> Questions:
> What is the use of "@fopen"?
> Does anyone see a better way?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php