note 10565 added to opendir

From: Date: Wed, 10 Jan 2001 20:59:04 +0000
Subject: note 10565 added to opendir
Groups: php.notes 
Request: Send a blank email to php-notes+get-9571@lists.php.net to get a copy of this message
This doesn't appear to work properly if you aren't in the my_dir directory: <pre> $path = "/home/web_site/www/my_dir"; $main = opendir($path); while($file = readdir($main)) { ... statements ... } closedir($main); </pre> however, if you add the chdir(), it works great: <pre> $path = "/home/web_site/www/my_dir"; chdir($path); $main = opendir($path); while($file = readdir($main)) { ... statements ... } closedir($main); </pre> http://www.php.net/manual/function.opendir.php

« previous php.notes (#9571) next »