Page 1 of 1

[solved]How to require a file which is in root

Posted: Thu Jan 15, 2004 9:07 am
by vigge89
How can I require a file (located in root, file1.php) in an PHP-script (file2.php) which is not in the root?
Structure:

Code: Select all

root
|_ file1.php
\_ somefolder
   |_ file2.php
|_ somefile.php
|_ some_other_file.php

Posted: Thu Jan 15, 2004 9:16 am
by twigletmac
Do you mean like:

Code: Select all

require '../file1.php';
Mac

Posted: Thu Jan 15, 2004 9:17 am
by vigge89
so .. means root?

Posted: Thu Jan 15, 2004 9:21 am
by twigletmac
../ means 'go back one level'. From 'somefolder' ../../ would take you to the folder that contains 'root'.

Mac

Posted: Thu Jan 15, 2004 9:27 am
by vigge89
ok, thanks!