Php 在变量中存储图像路径
我有一个存储用户图像路径的数据库,如images/profile/950baasfaa88c.jpg。现在,当我试着把它放进一个变量中,并用图像标签包围它时,只会出现一个空白图像,而不是图像本身Php 在变量中存储图像路径,php,database,image,variables,profile,Php,Database,Image,Variables,Profile,我有一个存储用户图像路径的数据库,如images/profile/950baasfaa88c.jpg。现在,当我试着把它放进一个变量中,并用图像标签包围它时,只会出现一个空白图像,而不是图像本身 $profile_picture = $row['profile_image']; <img src="'.$profile_picture.'" width=50 height=50 /> $profile\u picture=$row['profile\u image'];
$profile_picture = $row['profile_image'];
<img src="'.$profile_picture.'" width=50 height=50 />
$profile\u picture=$row['profile\u image'];
您还没有回显PHP
<img src="'.$profile_picture.'" width=50 height=50 />
应该是
<img src="<?= $profile_picture ?>" width=50 height=50 />
“宽度=50高度=50/>
您需要回显该值
<img src="<?php echo $row['profile_image']; ?>" width=50 height=50 />
“宽度=50高度=50/>
呈现页面上的“查看源代码”是什么样子?(从浏览器)您确定相应的图像放置在正确的位置吗?当找不到标记所指的图像时,浏览器会显示空白图像。在询问此类问题时,请尝试提供更多详细信息。是否可以通过获取页面源发布服务器返回的内容