Kohana URL (segmented)


Kohana URL (segmented)

在Kohana 2.3.4中,我使用查询字符串作为参数,并使用输入类来获取值。

localhost/回家吗?id = 1234

现在我迁移到Kohana 3.3.0,我有很多问题如何分割URL的工作。

我想实现这个:

localhost/home/1234

My Controller Home:

class Controller_Home extends Controller_Template {
    public function action_index($id) {
        //code goes here
    }
}

根据我对分段url的理解,我的控制器应该有这样的东西:

public function action_details($id) {
    //code here
}

但这意味着链接是localhost/home/details/1234。我希望不再有细节操作。我该怎么做呢?对不起,在我写这篇文章的时候,Kohana似乎正在走下坡路。

从3.3开始,你不能在action中使用参数。你只需要&$this->request->param('id')。看到http://kohanaframework.org/3.3/guide/kohana/routing请求参数