Jump to content

Php And Paths


Xero

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...