dynamic - PHP directory rules of thumb? -


i'm trying make sure file paths robust can be, , knows hard-coding paths can disastrous in lot of cases. there general rules of thumb regarding referencing paths? concerning referencing above $_server['document_root'].

i've been doing ../../(x100000), looks messy , hoping there cleaner way.

thanks

to current directory of running script do:

str_replace('//', '/', str_replace('\\', '/', dirname(__file__) . '/')); 

this little bit hacky it's reliable afaik.

but think not work windows unc paths (if use them)...


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -