You are here: Re: [PHP] Strange is_dir() behavior « PHP « IT news, forums, messages
Re: [PHP] Strange is_dir() behavior

Posted by Marek Kilimajer on 06/26/05 00:51

Marcos Mendonça wrote:
> Hello
>
> I'm using PHP 4.3.9, under Windows XP with Apache.
>
> I have the following directory structure on a given app, i'm working on.
>
> photos/
> > folder1
> > folder2
> > folder3
> > ... and so on
>
> I'm trying the following code to make a list of folder under photos:
>
> $d = dir('photos/');
>
> while (false !== ($entry = $d->read())) {
> if (is_dir($entry) && $entry != '.' && $entry != '..')
> echo $entry . "<br />";
> }
>
> For some strange reason, that echoes nothing. is_dir is returning
> false on every folder (dir)
> under photos, except for '.' and '..' dirs. Can someone explain this?

is_dir() is checking for 'folder1', 'folder2' etc. You want it to check
'photos/folder1', 'photos/folder2'....

Use:
if (is_dir('photos/' . $entry) ....

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация