Can someone explain the simple and easy words that what is the difference between ../ and. / When including files?

As we know that ../ means one step back and / means the current place, but I'm confused. / When working with my website and found this. Can someone explain?

+4
source share
4 answers

. means this directory

.. means parent directory

/ is a directory separator (for Linux / Unix)

When used, include "file.php";php will look in the current directory and in its configured include path for the file namedfile.php

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

include "../file.php";, php file.php

+1

./ - .
/ - ( , , host + '/' + cssFile).

0
  • / . - , index.html .
  • ./ "" , . index.html , ./ , /. root, /css/, ./ , /css/.
  • ../ . /css/, ../ , /, .
0
source

Suppose this is your work on a file called process.php in the following directory:

/app/form/process.php

Here is what these symbols mean:

/= root directory or in the example: /

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

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

0
source

Source: https://habr.com/ru/post/1666264/


All Articles