问题
I have a database that stores the path to the users image such as images/profile/950baasfaa88c.jpg. Now when i try to put this into a variable and surround it with image tags, only a blank image comes up not the image itself...
$profile_picture = $row['profile_image'];
<img src="'.$profile_picture.'" width=50 height=50 />
回答1:
you haven't echo PHP
<img src="'.$profile_picture.'" width=50 height=50 />
should be
<img src="<?= $profile_picture ?>" width=50 height=50 />
回答2:
you need to echo out the value
<img src="<?php echo $row['profile_image']; ?>" width=50 height=50 />
来源:https://stackoverflow.com/questions/11887879/storing-image-path-in-a-variable