array_slice()是幹什麼用的呢?
array_slice() 函數數組的分頁。
記憶方法:
array_slice--Extract a slice of the array
//執行個體
$count = count($newgoods);//總條數
$pagesize = 30;
$start=($page-1)*$pagesize;//偏移量,目前頁-1乘以每頁顯示條數
$newgoods = array_slice($newgoods,$start,$pagesize);
this->_view ['pagination'] = array('first'=>1,'last'=>ceil($count/30),'prev'=>$page,'next'=>$page+1,'page_base'=>1,'page_size'=>30,'record_count'=>$count,'current'=>$page);