Jump to content

getting the root directory


aleksanteri

Recommended Posts

Say I've got a library PHP file at a folder and I've got an index.php in a folder that is the subfolder of the folder with the library in it. Now I want to use include() to get the library file into the index.php file without being jumped to the main root folder. Is this possible and how do I do it?

Link to comment
Share on other sites

Haven't used PHP in awhile, but this should pull the file from the parent directory:

include('../library.php');

And this should pull it from the root directory:

include('/library.php');

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...