Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML:无法显示我的图像_Html - Fatal编程技术网

HTML:无法显示我的图像

HTML:无法显示我的图像,html,Html,注意:我的所有文件都在同一个目录中 我编写了一个简单的HTML来显示图像 <html> <body> <div style="margin:0 auto; width:100%; text-align:center;"> <p style="font-size:xx-large; font-weight:900;">My homework test</p> <!--Load a image

注意:我的所有文件都在同一个目录中

我编写了一个简单的HTML来显示图像

<html>
<body>
    <div style="margin:0 auto; width:100%; text-align:center;">
        <p style="font-size:xx-large; font-weight:900;">My homework test</p>

        <!--Load a image-->
        <img src="mini.jpg" />
    </div>
</body>
</html>

我的家庭作业测试

当我直接打开这个html时,它可以正确显示图像

但是当我尝试使用node.js服务器打开html时,它无法显示图像

<html>
<body>
    <div style="margin:0 auto; width:100%; text-align:center;">
        <p style="font-size:xx-large; font-weight:900;">My homework test</p>

        <!--Load a image-->
        <img src="mini.jpg" />
    </div>
</body>
</html>

Ctrl-Shift-I-按下它并在控制台中查找错误。它应该给你一个提示。我想在所请求的图像路径上肯定会发生一些有趣的事情。(虽然没有node.js经验)似乎图像路径错误,请尝试
/mini.jpg
?此HTML文件是否与图像位于同一目录/文件夹中?如果没有,您将需要在
src
@MrNew中提供完整路径,这不会产生任何影响。我发现了问题。问题在于我的node.js代码。谢谢所有推荐我的人。