绝对路径&相对路径 [英] Absolute path & Relative Path
问题描述
绝对路径和绝对路径有什么区别?使用任何 Web 服务器或 Tomcat 时的相对路径?
绝对路径以/开头,并引用从当前站点(或虚拟主机)的根目录开始的位置.
相对路径不以/开头,而是从引用文档的实际位置引用一个位置.
示例,假设 root 是 http://foo.com/site/
绝对路径,无论我们在网站的哪个位置
/foo.html
将参考http://foo.com/site/foo.html>
相对路径,假设包含链接位于http://foo.com/site/part1/bar.html
../part2/quux.html
将参考http://foo.com/site/part2/quux.html一个>
或
part2/blue.html
将参考http://foo.com/site/part1/part2/blue.html
What's the difference between absolute path & relative path when using any web server or Tomcat?
Absolute paths start with / and refer to a location from the root of the current site (or virtual host).
Relative paths do not start with / and refer to a location from the actual location of the document the reference is made.
Examples, assuming root is http://foo.com/site/
Absolute path, no matter where we are on the site
/foo.html
will refer to http://foo.com/site/foo.html
Relative path, assuming the containing link is located in http://foo.com/site/part1/bar.html
../part2/quux.html
will refer to http://foo.com/site/part2/quux.html
or
part2/blue.html
will refer to http://foo.com/site/part1/part2/blue.html
这篇关于绝对路径&相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!