Large inventory of Path Problems

Source: Internet
Author: User

1. physical path

The physical path is physicalpath, which refers to the file path in the hard disk. For example, 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

 

2. Relative Path

The full name of relative paths is relativepath. The following uses the example above to understand its usage in three aspects.

1. Files in the same directory

B .htmland c.html are under the same folder. If B .html#is linked to c.html, you can write in B .html as follows:

<A href = "c.html"> file links in the same directory </a>


2. Files in the parent directory

A.html is a file in the upper-level directory of B .html and c.html. If B .html or c.html is linked to a.html, you can write it in B .html or c.html as follows:

<A href = "../a.html"> link to a file in the parent directory </a>

In the Code, "../" indicates the upper-level directory (separated by a directory). In ".../../", write:

<A href = ".../../a.html"> link to the file in the upper-level directory of the upper-level directory </a>


3. Files in the lower-level directory

B .html and c.html are the files in the.html directory. If you want to link B .html in a.html, write them in a.html as follows:

<A href = "C/B .html"> link to a file in the lower-level directory (c) </a>

If the connector is linked to d.html in a.html, you can write it in a.html as follows:

<A href = "C/D/d.html"> link to a file in the lower-level directory (C/D/) </a>

 

3. absolute path

The full name of the absolute path is absolutepath, which contains the URL. For example, if you have a domain name www.lfsy.com whose domain name points to D: \ A, then the above four files can be expressed as follows:

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

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

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

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

 

Iv. root directory

The full name of the root directory is rootdirectory, and the domain name before the absolute path is the root directory, so it can be understood as the top directory of the website. Its representation is as follows:

<A href = "/B/a.html"> link to a.html </a>

<A href = "/B/C/B .html"> link to B .html </a>

<A href = "/B/C/c.html"> link to c.html </a>

<A href = "/B/C/D/d.html"> link to d.html </a>

 

Summary:

A physical path can be used to access a database or not use a web server. The root directory and absolute path are easy to use. They are all searched from the top directory of the website and checked down at the first level. Their disadvantage is that the program is not easy to transplant. Relative paths are most commonly used in website creation. Distinguish between these paths and avoid file failures when creating hyperlinks.

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.