gpt4 book ai didi

ruby /Sinatra/erb : 404 for loading image

转载 作者:数据小太阳 更新时间:2023-10-29 07:28:46 26 4
gpt4 key购买 nike

我尝试显示图像,但日志中的响应代码为 404:

0:0:0:0:0:0:0:1 - - [02/Nov/2013 11:23:55] "GET /public/images/gtk_refresh.png HTTP/1.1" 404 466 0.0030
0:0:0:0:0:0:0:1 - - [02/Nov/2013:11:23:55 MEZ] "GET /public/images/gtk_refresh.png HTTP/1.1" 404 466
http://localhost:4567/main-> /public/images/gtk_refresh.png

rb文件:

get '/main' do
erb: main
end

erb 文件:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1

/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>hello world</title>
</head>

<body>
<img src="public/images/gtk_refresh.png" />
</body>
</html>

我尝试了图像的相对和绝对路径,但它没有用。

最佳答案

改变:

<img src="public/images/gtk_refresh.png" />

到:

<img src="/images/gtk_refresh.png" />  

关于 ruby /Sinatra/erb : 404 for loading image,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19741171/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com