4

As we know that ../ means one step back and / means the current place but i am confused about the ./ when working with my web site and found that. Can anyone explain ?

  • 1
    `.` is what means "the current directory", not `/`, so `./` is how you make a path that starts at the current directory and descends into a subdirectory. – Pointy Jan 09 '17 at 14:54
  • http://www.coffeecup.com/help/articles/absolute-vs-relative-pathslinks/ – CodeGodie Jan 09 '17 at 14:55

4 Answers4

1

. means this directory

.. means the parent directory

/ is the directory separator (for Linux/Unix)

When using include "file.php"; php will look in the current directory and in his configured include path for a file named file.php

When using include "./file.php"; php will look in the current directory (and only there) for a file named file.php

if you use include "../file.php"; php will look in the parent directory for a file named file.php

ᴄʀᴏᴢᴇᴛ
  • 2,939
  • 26
  • 44
0

./ - current directory.
/ - it is root directory (it used often for concatenating paths as directory separator, because previous path doesn't contain leading slash, for example host + '/' + cssFile).

cn007b
  • 16,596
  • 7
  • 59
  • 74
0
  • / represents the root of a folder structure. For a website, it's the root folder, where you would usually put the index.html of the landing page.
  • ./ represents the 'current' folder, relative with the current file. If you open the 'index.html' file in the root folder, then ./ will be the same as /. If you are in a subfolder of the root, like /css/ for example, then ./ will be the same as /css/.
  • ../ represents the parent folder. If you are in /css/, then ../ will be the same as /, the root folder.
CCH
  • 1,516
  • 1
  • 13
  • 24
0

Lets say this is your working on a file called process.php in the following directory:

/app/form/process.php

The this is what those symbols mean:

/ = root directory, or in the example: /

./ = current directory, or in the example: /app/form/

../ = one directory back, in the example: app/

CodeGodie
  • 12,116
  • 6
  • 37
  • 66