图片由用户上传并存储在 public/users 文件夹中。视图脚本如下:
<?php echo $this->render("includes/header.phtml"); ?>
<div id="header">
<div class="w">
<div id="logo"><a href="/">SyncFan.com</a></div>
<div id="mainmenu">
<ul>
<li class="selected"><a href="/account/accountmanager"><span>My Account</span></a></li>
<li onMouseMove="$('.submenu',this).show();$(this).addClass('hover');" onMouseOut="$('.submenu',this).hide();$(this).removeClass('hover');"><a href="/artist/list"><span>View Artists</span></a></li>
<li onMouseMove="$('.submenu',this).show();$(this).addClass('hover');" onMouseOut="$('.submenu',this).hide();$(this).removeClass('hover');"><a href="/account/update"><span>Update Account</span></a></li>
<li onMouseMove="$('.submenu',this).show();$(this).addClass('hover');" onMouseOut="$('.submenu',this).hide();$(this).removeClass('hover');">
<a href="/account/logout"><span>Log Out</span></a>
</li>
</ul>
</div>
</div>
</div>
<div id="content" class="w">
<h2>SyncFan My Page - <?php $this->session = new Zend_Session_Namespace('login');echo $this->escape($this->session->username); ?></h2>
<!--- MAIN CONTAINER -->
<table class="table">
<tr><td valign="top">
<!--PROFILE DATA-->
<table class="table ">
<tr><td>Username: <?php echo $this->session->username; ?></td></tr>
<tr><td><img src="<?php echo '../public/users/'.$this->avatar; ?>"/></td></tr>
<tr><td><?php echo $this->aboutme; ?></td></tr>
<tr><td>Date Joined: <?php echo $this->session->dateJoined?></td></tr>
</table>
</td>
<td valign="top">
<!--FAVORITE ARTIST LIST-->
<table class="table table-hover">
<?php if($this->artists){?>
<tr align="center">
<td><b>Artist Name</b></td>
<td><b>Date Became A Fan</b></td>
</tr>
<?php foreach($this->artists as $artist){?>
<tr>
<td><a href='/artist/video-list?artist=<?php echo
urlencode($artist['artist_name'])?>'>
<?php echo $this->escape($artist['artist_name']); ?></a></td>
<td><?php echo $this->escape($artist['date_became_fan']); ?></td></tr>
<?php }
}else{
?>
<tr><td>You currently have no favorite artists.</td></tr>
<?php }?>
</table>
</td>
</tr>
</table>
</div>
<?php echo $this->render("includes/footer.phtml"); ?>
在帐户视图中。HTML 语句的输出
<img src="<?php echo '../public/users/'.$this->avatar; ?>"/>
是空的。我能够获取上传图像的详细信息,但无法将其呈现给用户帐户。
<?php var_dump($this->avatar); ?>
上述语句的输出是字符串'filename.jpg'(长度=文件长度)。
我也检查了 .htaccess 文件,但找不到任何错误。任何帮助将不胜感激。