我目前正在使用拿铁咖啡来做事。我想不通的是如何在带有模板变量的查询中使用 foreach 循环。我下面的代码总是会返回Trying to get property of non-object
$query = $this->db->query("SELECT id FROM table");
$array = array();
while($fetch = $query->fetch_array()){
$array = $fetch;
}
$Template["qclisting"] = $array;
和模板代码
{foreach $qclisting as $item}
<a href="" class="list-group-item clearfix">
<span class="clear">
<span>{$item->id}</span>
</span>
</a>
{/foreach}