what is the difference between ./folder-name/file.php and ../folder-name/file.php in php script?
A:
../ is the directory below the directory you're currently in. ./ is the directory you're currently in. For example. If you are currently in /foo/bar. ../test.php is equivalent to /foo/test.php and ./test.php is equivalent to /foo/bar/test.php.
Sean
2009-11-12 19:46:20
Directory hierarchy goes up, not down.
Jesse O'Brien
2009-11-12 19:47:45
Apologies, yes, above rather than below, though the example is still sound.
Sean
2009-11-12 19:56:24
+5
A:
Path is interpreted by operation system you're using:
./
- usually means current folder../
- usually means parent folder
If you're in folder /home/user
, then
./folder-name/file.php
will point to/home/user/folder-name/file.php
- but
../folder-name/file.php
will point to/home/folder-name/file.php
, which is 1 level up
Ivan Nevostruev
2009-11-12 19:46:46
+2
A:
The first case, ./folder-name/file.php will start in your current directory.
The second case, ../folder-name/file.php will start from the parent directory.
cballou
2009-11-12 19:46:56