Reputation: 41999
in a tutorial I am doing, the code below is in index.php file. Does the second "." in the file indicate that index.php is not at the root level? what would the significance be of adding extra "." in that position?
require_once("../includes/database.php");
Upvotes: 1
Views: 1952
Reputation: 3330
This is a relative path to the current directory.
So the answer is yes, that file is not in the root level.
Upvotes: 5
Reputation: 20333
Not necessarily. For security reasons it is recommended that your include files be placed outside the web-accessible directory (htdocs), so minimizing the possibility of someone calling the database.php directly with forged parameters.
So the directory structure should look somthing like:
user
| |
| + htdocs
| |
| + index.php
|
+ includes
|
+ database.php
Upvotes: 4
Reputation: 318578
..
means "one directory up"; ../..
would mean "two directories up".
Upvotes: 3