javascript - 视图不显示图像
问题描述
我在视图的文件夹中有一张图片,但视图没有显示图片,我真的不知道为什么这会发生在我的身上。我尝试了此页面建议的解决方案,但它对我不起作用本地图像 URL 语法?
<br />
<hr >
<img src= "C:\Users\Raul del Rio\Desktop\grupo-29\app\views\Ajax2\load.jpeg" alt="Trulli" width="500" height="333"/>
<p> his page was loaded asynchrously through a Ajax request.
This page was loaded asynchrously through a Ajax request
This page was loaded asynchrously through a Ajax request
This page was loaded asynchrously through a Ajax request
This page was loaded asynchrously through a Ajax request
This page was loaded asynchrously through a Ajax request
This page was loaded asynchrously through a Ajax request
This page was loaded asynchrously through a Ajax request
This page was loaded asynchrously through a Ajax request
This page was loaded asynchrously through a Ajax request
This page was loaded asynchrously through a Ajax request
</p>
<hr >
<br />
解决方案
(\)
您可以通过用正斜杠替换所有反斜杠(/)
并添加file:/
作为文件路径的前缀来看到您的愿望,如下所示:
<img src="file:/C:/Users/Raul del Rio/Desktop/grupo-29/app/views/Ajax2/load.jpeg">
注意:
但请记住,您的图像路径应该是相对路径而不是绝对路径。当您将其部署到 Web 服务器时它将不起作用,这是现代浏览器的安全问题。
推荐阅读
- python - 如何将网页抓取的数据写入 csv?
- c - 将值分配给动态分配的 int 数组似乎超出了给定的限制
- c++ - '/usr/include/glib-2.0/glib/gurifuncs.h 从 glib-2.0 中丢失
- python - 具有复合索引 Mongodb 的高查询目标
- python - pandas groupby 并按排名列获取 val
- javascript - 试图为作为函数的变量提供一个值
- javascript - 通过javascript更改复选框并将值传递给php
- laravel - NGINX 不接受大于 1MB 的文件
- css - 防止 Safari 在拖动鼠标时切换到文本光标
- android - 如何在我的数据库中显示所有评论