0

我在 CodeIgniter 中使用了分页。

这是我在本地主机地址栏中的链接

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';

但这行不通。请给我建议。提前致谢

4

1 回答 1

0

您可以在不使用路由的情况下编写此代码,如下所示:将参数传递给您的主控制器上的函数索引,因为您的代码已放置。参数应该可以为空,因为没有发送记录号。IE

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

    function index($recordId = null) {
        if (!empty($recordId)) {
            //next button is clicked
        } else {
            // first time 
        }
    }
}
于 2013-08-30T11:46:16.300 回答