我寫的代碼在下面給出控制器,無法獲取ZF2分頁
$iteratorAdapter = new \Zend\Paginator\Adapter\Iterator($this->getCategoryTable()->listCategoryData());
$paginatorDatas = new \Zend\Paginator\Paginator($iteratorAdapter);
$paginatorDatas->setCurrentPageNumber($page)->setItemCountPerPage(5);
,我使變量$ paginatorDatas查看文件。
在對應的視圖文件中,我已經寫這樣的代碼,
echo $this->paginationControl($this->paginatorDatas, 'Elastic', 'paginator.phtml');
之前調用$這 - > paginationControl()函數我已經迭代數組對象($ paginatorDatas),通過foreach(){}
填充記錄。
但上面的代碼提供了以下錯誤,
致命錯誤 :未捕獲的異常「的Zend \ DB \適配器\異常\的RuntimeException」與消息「這一結果是僅正向結果集,調用倒帶()之後向前移動不支持'/var/www/cp/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Result.php:153堆棧軌跡:#0 [內部函數]:Zend \ Db \ Adapter \ Driver \ Pdo \ Result-> rewind()#1 /var/www/cp/module/Admin/view/admin/category/ajax-list.phtml(21):LimitIterator-> rewind()#2/var/www/cp/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(507):include('/ var/www/cp/mod ...')#3/var/www/cp/vendor/zendframework/zendframework/library/Zend/View/View.php(205):Zend \ View \ Renderer \ PhpRenderer-> ren der(Object(Zend \ View \ Model \ ViewModel))#4 /var/www/cp/vendor/zendframework/zendframework/library/Zend/Mvc/View/Http/DefaultRenderingStrategy.php(102):Zend \ View \ View - > render(Object(Zend \ View \ Model \ ViewModel))#5 [內部函數]:Zend \ Mvc \ View \ Http \ DefaultRenderingStrategy-> render(Object(Zend \ Mvc \ MvcEvent))#6/var/www在線/ CP /在/var/www/cp/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Result.php 153
請幫我....
方法2適用於我...謝謝... 第一種方法拋出相同的錯誤... – EKL
@EKL然後,考慮接受並upvoting這個答案! –