Jump to content

Php And Paths


Xero
 Share

Recommended Posts

Hello.I have one project here that is separated by folders:

.www..test...test.php..main...index.php
I want that the file index.php includes the test.php file. How can I do in a way that I don't need to know the DOCUMENT_ROOT and don't need to use '../'?For example. In html, I just use '/test/test.php' and it works. How can I do this in php?I hope I was clear on my question.Thank you for reading.Help me!
Link to comment
Share on other sites

Uh, that should work in php too, I think. The rules for file locations etc. are the same.

Link to comment
Share on other sites

On a Linux server the file system root as at /, so if you're telling it to look for /test it's going to assume you're looking for a folder called test in the root of the filesystem.You can either use ../ or use something like $_SERVER['DOCUMENT_ROOT'] to start with.

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
 Share

×
×
  • Create New...