[nycphp-talk] Search of directories and files on my web server
Steve Manes
smanes at magpie.com
Thu Aug 16 19:59:45 EDT 2007
Aaron Fischer wrote:
> if (is_dir($item) && $item !='.' && $item!='..') {
> search($path . '/' . $item);
> }
> if (is_file($item)) {
> $file=file($item);
...
Don't forget that since you're not doing a chdir() before recursing that
you're still looking at files in the context of your original working
directory.
Change it to:
$filepath = "${path}/${item}";
if (is_file($filepath)) {
$file=file($filepath);
and it should work.
More information about the talk
mailing list