4
我用ZendFramework分頁程序,我有一些像這樣的代碼:zend框架paginator不起作用?
$defaultCount=1000;
$db = Zend_Db_Table::getDefaultAdapter();
$select = $db->select();
$select->from(array('u' => 'core_users'));
$select->join(array('ur' => 'core_users_roles'), 'u.uid = ur.uid');
$select->join(array('r' => 'core_roles'), 'r.rid = ur.rid');
$adapter=new Zend_Paginator_Adapter_DbSelect($select);
$adapter->setRowCount($db->select()->from('core_users',array(Zend_Paginator_Adapter_DbSelect::ROW_COUNT_COLUMN =>'uid')));
$paginator= new Zend_Paginator($adapter);
$paginator->setItemCountPerPage($defaultCount);
$paginator->setCurrentPageNumber($page);
,但是,我不能得到全部來自DbSelect Adapter.when我的數據我刪除$ defaultCount,它總是給我20個總數據量(默認,我猜)。我應該用單桌嗎?