首页 > 解决方案 > 视图不显示图像

问题描述

我在视图的文件夹中有一张图片,但视图没有显示图片,我真的不知道为什么这会发生在我的身上。我尝试了此页面建议的解决方案,但它对我不起作用本地图像 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 />

标签: javascripthtmlimage

解决方案


(\)您可以通过用正斜杠替换所有反斜杠(/)并添加file:/作为文件路径的前缀来看到您的愿望,如下所示:

<img src="file:/C:/Users/Raul del Rio/Desktop/grupo-29/app/views/Ajax2/load.jpeg">

注意:
但请记住,您的图像路径应该是相对路径而不是绝对路径。当您将其部署到 Web 服务器时它将不起作用,这是现代浏览器的安全问题。


推荐阅读