访问更高文件夹中的内容

发布于 2025-01-07 07:40:55 字数 496 浏览 1 评论 0原文

如果我有以下索引,

[folder]Public_HTML
       ↳[folder]img
               ↳[file]logo.png
       ↳[file]index.html
       ↳[folder]contact
               ↳[file]index.html

从标题为 img 的文件夹中,我可以使用 HTML 将文件 logo.png 添加到文件夹 public_HTML 下的 index.html 中。 但我如何从名为 contact 的文件夹下提交的 index.html 访问此 img 文件,而不需要在前面添加域名,例如 http://mydomain.com/img/logo.png。或者这是从联系人文件夹访问它的唯一方法。

If I have the following index

[folder]Public_HTML
       ↳[folder]img
               ↳[file]logo.png
       ↳[file]index.html
       ↳[folder]contact
               ↳[file]index.html

From the folder titled img I can add the file logo.png to the index.html under the folder public_HTML by using the HTML <img src="img/logo.png"/> but how could I access this img file from the index.html filed under the folder titled contact without requiring to add the domain name in front for e.g http://mydomain.com/img/logo.png. or is this the only way it can be accessed from the contact folder.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

思念绕指尖 2025-01-14 07:40:55

您可以使用双点向上移动一个文件夹:
< img src="../img/logo.png" />

如果您想上移更多文件夹,它可能如下所示:
< img src="../../img/logo.png"/>

you can use double dots to move one folder up:
< img src="../img/logo.png" />

If you want to move up more folder, it could look like:
< img src="../../img/logo.png"/>

巡山小妖精 2025-01-14 07:40:55

。在开头添加斜杠使路径成为绝对路径。

<img src="/img/logo.png"/>. Adding a slash at the beginning makes the path absolute.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文