我是zend framewrok的新手。我試圖從索引視圖中顯示圖像。以下是我的代碼:如何從索引視圖顯示zend framewrok上的圖像?
<?php
echo "Student List";
//$this->headTitle($this->title);
?>
<p><a href="<?php echo $this->url(array('controller'=>'index',
'action'=>'add'));?>">Add new student</a></p>
<table>
<tr>
<th>Name</th>
<th>Email</th>
<th>Photo</th>
<th> </th>
</tr>
<?php foreach($this->students as $student) : ?>
<tr>
<td><?php echo $this->escape($student->name);?></td>
<td><?php echo $this->escape($student->email);?></td>
<td><img src='opt/lampp/htdocs/framework/zf-tutorial/project.png' alt='sdfsd'></td>
<td>
<a href="<?php echo $this->url(array('controller'=>'index',
'action'=>'edit', 'id'=>$student->id));?>">Edit</a>
<a href="<?php echo $this->url(array('controller'=>'index',
'action'=>'delete', 'id'=>$student->id));?>">Delete</a>
</td>
</tr>
<?php endforeach; ?>
</table>
它只顯示替代文字而不是圖像。請幫幫我。
我用$ fileName = $ upload-> getFileName('photo'); $ fileName = basename($ fileName);獲取文件名稱可以說,我怎麼才能收到它之前重命名文件的名稱。 – user1939096
檢查Zend過濾器重命名http://framework.zend.com/manual/1.12/en/zend.file.transfer.filters.html#zend.file.transfer.filters.rename – opHASnoNAME