how to include a file from another dir

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I wonder how i can include a file from another directory....

is this possible ?


Dennis T. Holm

Re: how to include a file from another dir

 .oO(Dennis T. Holm)

Quoted text here. Click to load it

If the directory exists, sure. But be aware that PHP accesses the files
directly through the filesystem. The above would start from the root
directory of the filesystem, not the document root of the webserver. If
you want to start from the document root you can use something like

include $_SERVER['DOCUMENT_ROOT'].'/file.php';

It's also possible to access files outside the document root:

include $_SERVER['DOCUMENT_ROOT'].'/../include/file.php';


Site Timeline