我試圖捕獲CodeIgniter for循環中的最後一個循環。我試圖在每個新聞項目下產生一個< hr />,但最後一項。這是我的代碼:CodeIgniter中的最後一個循環foreach
<table class="news">
<?php foreach($news as $news_item): ?>
<tr>
<td class="headline"><?php echo $news_item['title']; ?></td>
</tr>
<tr>
<td class="text"><?php echo $news_item['text']; ?></td>
</tr>
<tr>
<td><hr /></td>
</tr>
<?php endforeach; ?>
</table>
這是你的問題嗎?是不是工作或其他.. –