2013-03-01 19 views
0

我在CodeIgniter中使用了分頁。如何在CodeIgniter中的contrller後忽略id

這是在我的本地

PicTraveller/branches/1.0.1/Implementation/index.php/home

我在地址欄鏈接當我點擊下一步,然後接下來的5條記錄將顯示。我點擊下一步後: PicTraveller/branches/1.0.1/Implementation/index.php/home/5

我然後在路線要寫入的文件這樣的: $route['home/(:any)']= 'home/$1';

但是,這是不行的。請建議我。在此先感謝

+0

家是我的控制器 – user2122323 2013-03-01 10:29:10

回答

0

您可以不使用路線如下編寫此: 將參數傳遞到您的家庭控制器上的函數索引,因爲您的代碼被放置。 參數應該是空的,因爲第一次沒有記錄號碼發送。 即

class Home extends CI_Controller 
{ 
    function __construct() { 
     parent::__construct(); 
    } 

    function index($recordId = null) { 
     if (!empty($recordId)) { 
      //next button is clicked 
     } else { 
      // first time 
     } 
    } 
}