该视图不显示图像

时间:2018-11-18 21:14:57

标签: javascript html image

我在视图的文件夹中有一个图像,但是该视图未显示该图像,而且我真的不知道为什么这是我的原因。 我尝试了此页面建议的解决方案,但对我没有帮助Local image URL syntax?

enter image description here

<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 />

1 个答案:

答案 0 :(得分:0)

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

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

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