search
HomeCommon ProblemWhat does the path of a file describe?

What does the path of a file describe?

Nov 19, 2020 am 10:31 AM
relative pathabsolute path

The path of a file is used to describe: the directory location of the file on the disk, or the location in the website folder structure. Paths are divided into absolute paths and relative paths; absolute paths refer to the absolute location in a directory, which directly reaches the target location, usually the path starting from the root directory; relative paths refer to the path between the file and other files (folders) caused by the path where the file is located. path relationship.

What does the path of a file describe?

#The path of a file is used to describe: the directory location of the file on the disk, or the location in the website folder structure.

Paths are divided into absolute paths and relative paths.

Absolute path refers to the absolute location under the directory, directly reaching the target location, usually the path starting from the drive letter (root directory).

The path that completely describes the file location is the absolute path, which is the directory path based on the root directory of the web site. The absolute path name is specified from the root directory at the top of the tree directory structure to a directory or file. It consists of a series of consecutive directories separated by slashes until the directory or file to be specified. The last name is the directory or file to point to. The reason why it is called absolute means that when all web pages reference the same file, the path used is the same.

//绝对路径,指向一个因特网文件的完整 URL
<img src="/static/imghwm/default1.png"  data-src="https://www.w3school.com.cn/images/picture.jpg"  class="lazy"   alt="flower">

Relative path refers to the path relationship with other files (or folders) caused by the path where this file is located. Using relative paths can bring us a lot of convenience. HTML absolute path refers to the full path of the file with domain name.

//文件路径指向了位于当前网站根目录中 images 文件夹里的一个文件:
<img src="/static/imghwm/default1.png"  data-src="/images/picture.jpg"  class="lazy"   alt="flower">

Comparison of absolute paths and relative paths

Advantages of absolute paths in network applications:

1. Prevent websites If it is maliciously plagiarized, use an absolute path. If someone plagiarizes and collects your content, the link inside will still point to your website. Some plagiarists are lazy and even copy the links inside.

2. If the webmaster cannot make a 301 redirect and therefore has URL normalization issues, using absolute paths will help the link point to the selected URL version.

3. Even if the web page is moved, the links inside still point to the correct URL.

Disadvantages of absolute paths:

1. Unless the link is dynamically inserted, there is no way to test it on the test server. Because the link inside will point directly to the real domain name URL, not the URL in the test server.

2. Unless the link is dynamically inserted, it will be difficult to move the content page. Because the location of the content page changes, links on other pages may not change accordingly, and still point to the original hard-coded absolute path.

The above is the detailed content of What does the path of a file describe?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)