访问更高文件夹中的内容
如果我有以下索引,
[folder]Public_HTML
↳[folder]img
↳[file]logo.png
↳[file]index.html
↳[folder]contact
↳[file]index.html
从标题为 img 的文件夹中,我可以使用 HTML
但我如何从名为 contact 的文件夹下提交的 index.html 访问此 img 文件,而不需要在前面添加域名,例如 http://mydomain.com/img/logo.png。或者这是从联系人文件夹访问它的唯一方法。 将文件 logo.png 添加到文件夹 public_HTML 下的 index.html 中。
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用双点向上移动一个文件夹:
< 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"/>

。在开头添加斜杠使路径成为绝对路径。<img src="/img/logo.png"/>
. Adding a slash at the beginning makes the path absolute.