<?php
$avatar_location = $_SESSION['p_avatar_location'];
$avatar_location = "avatar/".$avatar_location;
$avatar_location = (string)$avatar_location;
echo "avatar location: " $avatar_location;
?>
<img src=$avatar_location alt="Avatar" class="avatarlogin">
我想将$avatar_location
作为src
传递,但显示给我的是错误图像,但是它会打印正确的图像位置:
头像位置:avatar / avatar5.png
我已经尝试过<img src="avatar/avatar5.png" alt="Avatar" class="avatarlogin">
,并且可以正常工作。如何传递$avatar_location
变量以显示图像?
答案 0 :(得分:1)
使用header.liquid
标签
<?php ?>
答案 1 :(得分:0)
您必须在<?php ?>
内打印img标签
<?php
echo "<img src='{$avatar_location}' alt='Avatar' class='avatarlogin>";
?>