Page 1 of 1

File Path

Posted: Tue Mar 09, 2010 10:18 pm
by michaeru
Is it better to use the full path when including or requiring a file? Or is it just okay to use something like this include('../../file.php')?

And is it safe to include something like this include('www.website.com/fileToInclude/file.php')?

Re: File Path

Posted: Tue Mar 09, 2010 11:40 pm
by requinix
Using relative paths is a bad idea. Including from a website is a horrible idea.

Code: Select all

include $_SERVER["DOCUMENT_ROOT"] . "/path/to/file.php";

Re: File Path

Posted: Wed Mar 10, 2010 2:51 am
by michaeru
Okay, thanks.