Recently encountered a small problem in the project, tangled for half a day.
The difference between using a slash/and a backslash in a path is exactly what. After consulting some information, we know.
UNIX uses a diagonal bar/as a path separator, and Web applications are most recently used on UNIX systems, so all network addresses currently use a diagonal bar/separator.
Windows uses a backslash \ as a path separator because it is used as a parameter marker for a DOS command prompt and is not confusing. So the file browser on the Windows system is currently using the backslash \ as the path separator. As the development, the DOS system has been eliminated, the command prompt also uses very few, the oblique pole and the backslash in most cases may interchange, has no influence.
After you know this background, you can summarize the conclusion:
(1) Browser address bar site using a diagonal bar/;
(2) Windows file browser using a backslash \;
(3) The path that appears in the HTML URL () property, the path specified is the network path, and must be in a diagonal bar/;
Copy Code code as follows:
<div style= "Background-image:url (/image/control/title.jpg);
Background-repeat:repeat-x; padding:10px 10px 10px 10px "></div>
If the URL is followed by a backslash, no background is displayed
(4) The path that appears in the normal string, if the path of the Windows file is represented, using the diagonal bar/and the backslash \ is the same, and if the network file path is represented, you must use a diagonal bar/;
Copy Code code as follows:
Local file path,/and \ is equivalent
Network file path, be sure to use a diagonal bar/
The difference between a diagonal rod/and a backslash is basically this, and then the relative path and absolute path are discussed below.
Copy Code code as follows:
/src/writes the SRC folder in the current directory;
.. /src/writes this to the current directory in the upper-level directory of SRC folders;
/src/This means that the project root directory (can only disk root directory, can also refer to the project root directory, depending on the actual situation)