You are here: Re: problem with functions and paths « PHP Programming Language « IT news, forums, messages
Re: problem with functions and paths

Posted by Erwin Moller on 06/19/07 08:43

harvey wrote:

>
> Can anyone tell me how PHP handles paths?
> Do all functions require fully qualified paths or can some use relative
> paths?
>
> I'm having a problem with a foreach/glob() at the moment but have others
> to sort out. Is it different for windows and linux?
>
> On Windows:
> if I do (using apache2)
>
> $path = 'c:\server\mydomain\';
>
> foreach (glob($path . "*", GLOB_ONLYDIR) as $folder) {
> dothis();
> }
>
> It all works fine but if I set $path as:
> $path = '../../../mydomain/';
>
> I get an:
> Warning: Invalid argument supplied for foreach()
> I've tried reversing and escaping the slashes with no luck.
>
> Is there a fixed rule for relative & fully qualified paths?
>
> Thanks

Hi,

I never used relative paths in glob.
Why not make a full path first of your relative path?

And also: Why not check first if your target directory is actually a
directory before feeding it to glob? Use function is_dir().

Regards,
Erwin Moller

 

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

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