Re: problems with opendir()
| From: | Erwin | Date: | Wed, 25 Sep 2002 06:53:16 +0000 |
| Subject: | Re: problems with opendir() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117526@lists.php.net to get a copy of this message | ||
Man In The Box wrote:
> hmm i seem to be having a problem with opendir(). perhaps one of you
> could shed some light on the subject.
>
> here is the line of code (practically right out of the documentation)
>
> if ($handle = opendir('$_SERVER[DOCUMENT_ROOT]/files/$dir')) {
>
> blah blah blah;
> }
Because you are using single quotes (') the line don't get parsed, and the
directory you're pointing at is:
$_SERVER[DOCUMENT_ROOT]/files/dir
That doesn't seems correct to me, because the $_SERVER part won't be
replaced by the actual value. Use
$_SERVER['DOCUMENT_ROOT'] . '/files/dir' OR
"$_SERVER['DOCUMENT_ROOT']/files/dir" instead
HTH
Erwin