I’m trying to make sure my file paths are as robust as they can be, and everyone knows that hard-coding paths can be disastrous in a lot of cases. Are there any general rules of thumb regarding referencing paths? Mostly concerning referencing above $_SERVER[‘DOCUMENT_ROOT’].
I’ve been doing ../../(x100000), but it looks messy and was hoping there was a cleaner way.
Thanks
To get the current directory of the running script I usually do:
This is a little bit hacky but it’s reliable AFAIK.
But I think it will not work with Windows UNC paths (if you use them)…