Php Zend Framework 2中的“此结果是仅向前的结果集”
这是我的控制器:Php Zend Framework 2中的“此结果是仅向前的结果集”,php,zend-framework2,Php,Zend Framework2,这是我的控制器: class SomeController extends AbstractActionController { protected $productTable; protected $imageTable; public function indexAction() { return new ViewModel(array( 'products' => $this->getProductTab
class SomeController extends AbstractActionController
{
protected $productTable;
protected $imageTable;
public function indexAction()
{
return new ViewModel(array(
'products' => $this->getProductTable()->fetchAll(),
'images' => $this->getImageTable()->fetchAll(),
));
}
}
下面的代码首先是我的观点,它工作得很好
<?php foreach ($products as $product) : ?>
// Some code to display product, but not image
<?php endforeach; ?>
如果我解开这个循环,它就可以正常工作了。
谢谢你的阅读,对不起,我的英语不好。你也提到了吗?
<?php foreach ($products as $product) : ?>
<?php foreach ($images as $image) : ?>
// Some code to display product and image
<?php endforeach; ?>
<?php endforeach; ?>
This result is a forward only result set, calling rewind() after
moving forward is not supported.