当前位置:网站首页>Understand various paths
Understand various paths
2022-07-29 01:30:00 【M78_ Domestic 007】
Paths can be divided into relative paths and absolute paths
Further subdivide the local relative path and the local absolute path 、 Network relative path and network absolute path 、 Local relative root path and network relative root path .
Local absolute path
It is the full display path of a file in our computer , Such as :

What is shown here is an absolute path , Start from the root drive letter of the computer and write to the location of the files we need one by one .
Local relative path
Relative to the file path of the current file , Most of us use relative paths when importing external files .
for instance :
We are html Import pictures into the document <img src="./img/jj2.jpg">, there "./" You can also directly not write "./" Both mean relative to this html The folder location where the document exists under the file path ,html The location of is D:\h5\ Back end \code\node\jtweb, Then the position of this picture is D:\h5\ Back end \code\node\jtweb\img\jj2.jpg
Network absolute path
Is a complete website :http://ip: port / Access address ?querystring#hash
Remember to write an agreement ! We don't need to enter the agreement when we enter the URL in the browser , Because the browser has error correction function , Will automatically add , But when we program, we can't .
Network relative path
Is the path relative to the current server access address .
such as : The current URL :" agreement ://ip:port /src/news/index.html querystring hash"
There will be src and href Wait for network request , Such as "./src/18.jpg", It is relative to index.html Location , Its complete form is " agreement ://ip:port /src/news/src/18.jpg", The same as the local relative path , Don't write "./","src/18.jpg" It's the same .
reflection 1:
User input web address :" http://192.168.1.3:8080/user/ro/tupian/a.html?n=20"
Opened a page , In this page, there is a img Of src yes : "./img/jj2.jpg"
What is the real website of this picture
answer : "http://192.168.1.3:8080/user/ro/tupian/img/jj2.jpg"
reflection 2:
User input web address :"http://192.168.1.3:8080/user/ro/tupian"
Opened a page , In this page, there is a img Of src yes :"./img/jj2.jpg"
What is the real website of this picture
answer : Its real website :"http://192.168.1.3:8080/user/ro/img/jj2.jpg"
Local relative root path
use "/" Express , How to write it :<img src="/img/jj2.jpg">, At this time, the path of this image is directly relative to its disk , If it's in C disc , So the whole path is C:/img/jj2.jpg.
Network relative root path
Also use "/" Express ,src='/img/jj2.jpg', In a network request , Directly relative to the position behind the port .
Such as :
User input web address : http://192.168.1.3:8080/user/ro/tupian
Opened a page , In this page, there is a img Of src yes : "/img/jj2.jpg"
What is the real website of this picture ?
answer : Its real website :"http://192.168.1.3:8080/img/jj2.jpg"
边栏推荐
猜你喜欢

Principle and usage setting of large page memory

C language 300 lines of code to achieve mine sweeping (deployable + markable + changeable difficulty level)

【idea】查询字段使用位置

Seven SQL performance optimizations that spark 3.0 must know

什么是原码、反码和补码

【SQL之降龙十八掌】01——亢龙有悔:入门10题

Hilbert transform and instantaneous frequency

DVWA之SQL注入

Redis installation, cluster deployment and common tuning

Day2: 130 questions in three languages
随机推荐
Openpyxl merge cells
Log4j dynamic loading configuration file
[MySQL] string to int
Self-attention neural architecture search for semantic image segmentation
Three ways of creating indexes in MySQL
Rewriting method set
RHCE command practice (II)
【Leetcode-滑动窗口问题】
Django uses the existing data table method of MySQL database
Numpy 常见函数及使用
APP接入Kakaotalk三方登录
Main causes of IT hardware failures and best practices for prevention
App access kakaotalk three party login
Flask project construction 2
A ten thousand word blog post takes you into the pit. Reptiles are a dead end [ten thousand word pictures]
Intel带你初识视觉识别--OpenVINO
全面升级,淘宝/天猫api接口大全
Django使用MySQL数据库已经存在的数据表方法
Openpyxl border
Closures and decorators