Zend framework2 ZEND此结果是仅向前的结果集,不支持在向前移动后调用rewind()
我在此代码后出现此错误: 此结果是仅向前的结果集,不支持在向前移动后调用rewind() Page.phtml:Zend framework2 ZEND此结果是仅向前的结果集,不支持在向前移动后调用rewind(),zend-framework2,Zend Framework2,我在此代码后出现此错误: 此结果是仅向前的结果集,不支持在向前移动后调用rewind() Page.phtml: foreach ($company as $key => $value) { foreach ($userfeature as $key => $data) {
foreach ($company as $key => $value)
{
foreach ($userfeature as $key => $data)
{
echo "<tr>";
if($value->site_id == $data->site_id)
{
echo "<td>".$value->party_code." ".$value->party_name. "</td>";
}
}
}
Userfeaturetable.php
public function getUserFeature($user_id)
{
$user_id = (int) $user_id;
$rowset = $this->tableGateway->select(array('user_id' => $user_id));
$row = $rowset->current();
if (!$row)
{
throw new \Exception("Could not find row $user_id");
}
return $row;
}
companyTable.php
public function fetchAll()
{
$resultSet = $this->tableGateway->select();
return $resultSet ;
}
为什么我没有权利嵌入我的两个“foreach()”?您需要缓冲结果
public function fetchAll()
{
$resultSet = $this->tableGateway->select();
$resultSet->buffer();
return $resultSet ;
}
你需要缓冲结果
public function fetchAll()
{
$resultSet = $this->tableGateway->select();
$resultSet->buffer();
return $resultSet ;
}