Reputation: 15269
Well, it is a litte bit strange, since I remember that if I wan't to go to the directory back, then I need to do the following: include("../something-in-back-folder.php");
but it throws up an error with message that the file was not found. So I've prepared some code to check this out:
echo "<pre>".print_r(scandir("../"), 1)."</pre>";
I've executed it in file with location:
public_html => app => actions => post.php
but the above code said, that back from my direction there are the following folders:
Array
(
[0] => .
[1] => ..
[2] => private_html
[3] => public_html
)
It should return 'actions' folder instead. Right?
Isn't this strange? Or I've missed something? If so, then how can I include/open something that is one(or even two) folders back from my current directorty?
Upvotes: 2
Views: 1282
Reputation: 5919
You are correct that the ..
notation indicates a reference to the parent folder. Your analysis reveals that your PHP current working directory is at the public_html level; this isn't unusual. Make your reference relative to PHP's current working directory. Assuming you want to get at the 'actions' folder from post.php, say:
include('app/actions/something-in-back-folder.php');
Upvotes: 1