Large inventory of Path problems

Source: Internet
Author: User

One, physical path

The English name of the physical path is: PhysicalPath, which refers to the path of the file on the hard disk, such as the following file location representation method:

D:\A\B\a.html

D:\A\B\C\b.html

D:\A\B\C\c.html

D:\A\B\C\D\d.html

Second, relative path

The relative path of the English full name is: RelativePath, below we use the above example from three aspects to understand its usage.

1. file that represents a sibling directory

B.html and c.html in the same folder, if b.html need to link to c.html, you can write this in b.html:

<a href= "c.html" > Links between files in the same directory </a>


2. Files that represent the parent directory

A.html is a file in the parent directory of b.html and c.html, and if b.html or c.html is linked to a.html, it can be written in b.html or c.html:

<a href= ". /a.html "> links to files in the parent directory </a>

In the code, ".. /"represents a level parent directory (one directory at a interval),". /.. /"On behalf of level two superior directory (two directories), such as A.html is the top two directory of d.html, when d.html need to link to a.html, you can write in d.html:

<a href= ". /.. /a.html "> links to files in the parent directory of the parent directory </a>


3. Files that represent sub-directories

B.html and c.html are files in the subordinate directory of a.html, and if you want to link to b.html in a.html, you need to write this in a.html:

<a href= "c/b.html" > link to file in subordinate directory (C) </a>

If you need to link to d.html in a.html, you can write this in a.html:

<a href= "c/d/d.html" > links to files in a subordinate directory (c/d/) </a>

Three, Absolute path

The absolute path is the English full name: Absolutepath, which is the path with the URL. For example, you have a domain name www.lfsy.com, its domain name points to d:\a, then the above four files can be said:

<a href= "http://www.lfsy.com/B/a.html" > Linked to A.html</a>

<a href= "http://www.lfsy.com/B/C/b.html" > Linked to B.html</a>

<a href= "http://www.lfsy.com/B/C/c.html" > Linked to C.html</a>

<a href= "http://www.lfsy.com/B/C/D/d.html" > Linked to D.html</a>

Four, root directory

The English name of the root directory is: rootdirectory, removing the domain name in front of the absolute path is the root directory, so it can be understood as the top-level directory of the site. It is represented in the following way:

<a href= "/b/a.html" > Linked to A.html</a>

<a href= "/b/c/b.html" > Linked to B.html</a>

<a href= "/b/c/c.html" > Linked to C.html</a>

<a href= "/b/c/d/d.html" > Linked to D.html</a>

Summary:

Physical paths are generally available for Access databases or for situations that do not pass through a Web server. The use of the root directory and the absolute path is simple, from the top-level directory of the site to find, a level down. Their disadvantage is that the program is not easy to transplant. Relative paths are most commonly used in the production of Web sites. Distinguish between these kinds of paths, in the future when you set up a hyperlink do not appear to find the file problem.

Large inventory of Path problems

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.