0

我在 SPIFFS 中存储了一张图像当我启动浏览器并输入 esp8266 IP 地址/images/image.jpg 时,我可以看到该图像。该图像还显示在根目录的 index.html 页面中。

当我生成一个页面时

server.send(500, "text/html", "<head><title>esp8266</title></head><body><div id=\"banner\"><img src=\"/images/image.jpg\" width=\"900\" height=\"295\" /></div>  <div id=\"page\"></body</html>");

该页面不显示图像,只是一个图像占位符。而且我无法再通过 IP 地址/images/image.jpg 访问该图像。我在想 server.send() 改变了根的上下文。

感谢您的任何帮助。

4

1 回答 1

0

在这种情况下,我要做的第一件事是尝试将该 html 页面作为静态文件提供,并查看它是否有效。例如

server.serveStatic("/index.html", SPIFFS, "/static/index.html");

或者,这一切的发生只是因为 HTML 格式错误。

<div id=\"page\"></body</html>

于 2018-04-29T18:21:02.663 回答