The difference between a slash/and a backslash \ in a path

Source: Internet
Author: User

Recently encountered a small problem in the project, tangled half a day.

What is the difference between using a slash/and a backslash \ in a path. After reviewing some information, we know.

UNIX uses a diagonal bar/As a path delimiter, and Web apps are most recently used on UNIX systems, so all network addresses currently use a slash/delimiter.

Windows is marked with the use of a diagonal bar/As a parameter of the DOS command prompt, and in order not to be confused, use the backslash \ as the path delimiter. So the file browser on the Windows system is now using the backslash \ as the path delimiter. With the development of the DOS system has been eliminated, the command prompt is also used very rarely, the oblique bar and the backslash in most cases can be interchanged, no impact.

Knowing this background, you can summarize the conclusion:

(1) The browser address bar URL using the diagonal bar/;

(2) The Windows file Browser uses a backslash \;

(3) The path that appears in the HTML URL () attribute, the specified path is a network path, so you must use a diagonal bar/;

<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 it represents a Windows file path, uses the slash/and backslash \ is the same, or if the network file path is represented, you must use a diagonal bar/;

//local file path,/and \ is equivalent to //Network file path, be sure to use the diagonal bar/

The difference between a diagonal bar/and a backslash is basically these, and the relative and absolute paths are discussed below.

./src/this writes the SRC folder in the current directory;

.. /src/this to indicate that the current directory in the previous level of the directory in the SRC folder;

/src/this to indicate that the project root directory (can only disk root directory, can also refer to the project root directory, depending on the actual situation)

The difference between a slash/and a backslash \ in a path

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.