Re: fopen
| From: | Coert Metz | Date: | Mon, 17 Mar 2003 00:56:55 +0000 |
| Subject: | Re: fopen | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-139893@lists.php.net to get a copy of this message | ||
Hi
If i'm reading your code in the right way, i think
you can better use the file_exists function available
in php
Read the manual at:
http://www.php.net/manual/nl/function.file-exists.php
Many success
Coert Metz
Sebastian wrote:
hello, i have this snippet of code, from what i can tell it works .. just wondering if i am doing it in a correct way, or if there is a better, or faster way. thanks for any input. $fp = @fopen("$_SERVER[DOCUMENT_ROOT]/images/$mapname.jpg","r"); if ( $fp ) { $mappic = "<img border=\"0\" src='/images/mappics/$mapname.jpg'></a"; } else { $mappic = "<img border=\"0\" src='/images/noimage.gif'>"; } @fclose ( $fp ); echo $mappic; cheers, - Sebastian