I serched around but didn't get satisfactory answer.
In directory structure i want to know what is the use of ./
It doest impact if I use this in src.
Please let us know difference in ./ ../ and /
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Is there a way to play audio on a mobile browser w
./
is the current directory.../
is the parent directory of current directory./
is the root directory of the system.If this is about URLs, as it seems – the HTML attribute
src
takes a URL value – then it really has nothing to with directories. Interpretation of relative URLs takes place as string manipulation, without any reference to directories or files. (A resolved URL, absolute URL, may then be interpreted in a manner that maps things to a file system, but that is a different issue.)At the start of a URL,
./
has no effect (it is removed in interpreting a relative URL)../
causes the last part of the base URL, back to its last/
in it, to be removed before using it as a prefix/
causes the URL to be prefixed by the protocol and server part of the current base URLThus, assuming a base URL of
http://www.example.com/foo/bar/zap
,./test.html
resolves to the same astest.html
, namelyhttp://www.example.com/foo/bar/test.html
../test.html
resolves tohttp://www.example.com/foo/test.html
/test.html
resolves tohttp://www.example.com/test.html
Reference: STD 66.
If it happens that the absolute URLs are then interpreted, by the server running at www.example.com, in a simplistic (and common) manner by mapping them to a file system, then
./
maps to the same directory as the base URL,../
maps to its parent directory, and/
maps to the server root.They work like this:
./
— the current directory../
— the parent directory of the current directory/
— the root directory of the file systemExplanation
./ is the current directory.
../ is the parent directory of current directory.
/ is the root directory of the system.
You can also use
__FILE__
and__DIR__
to get the path.For more details look at this constants predefined