This is a discussion on how to include a file from another dir within the PHP Language forums, part of the PHP Programming Forums category; Hey I wonder how i can include a file from another directory.... is this possible ? include('/directory/file.php'); Dennis ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
.oO(Dennis T. Holm)
>I wonder how i can include a file from another directory.... > >is this possible ? > >include('/directory/file.php'); 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 this: include $_SERVER['DOCUMENT_ROOT'].'/file.php'; It's also possible to access files outside the document root: include $_SERVER['DOCUMENT_ROOT'].'/../include/file.php'; Micha |