0
我使用zend框架及其paginator来获取页面中的数组。每件事情都很好,但我对paginator的工作方式有疑问。 首先这是我的代码示例:zend框架分页器如何工作?
$arr=array(
'parviz','neda','yazdgerd','hooshang'
);
$paginator =new Zend_Paginator(new Zend_Paginator_Adapter_Array($arr));
$paginator->setItemCountPerPage(5);
$paginator->setCurrentPageNumber(1);
var_dump($paginator);
foreach ($paginator as $key => $value)
{
echo $key .'='.$value;
}
,当我用var_dump功能它表明某事像这样:
object(Zend_Paginator)[43]
protected '_cacheEnabled' => boolean true
protected '_adapter' =>
object(Zend_Paginator_Adapter_Array)[44]
protected '_array' =>
array
0 => string 'parviz' (length=5)
1 => string 'neda' (length=3)
2 => string 'yazdgerd' (length=5)
3 => string 'hooshang' (length=6)
protected '_count' => int 6
protected '_currentItemCount' => null
protected '_currentItems' => null
protected '_currentPageNumber' => int 1
protected '_filter' => null
protected '_itemCountPerPage' => int 5
protected '_pageCount' => int 2
protected '_pageRange' => null
protected '_pages' => null
protected '_view' => null
,当我使用Foreach
我让我的阵! 它是如何工作的? PHP中有没有像__tostring()
这样的函数来完成这些转换?