我想设置我的路由,使url如word/startswith?prefix=ab
映射到以下代码
class Controller_Word extends Controller_Mytemplate {
public function action_startswith($fragment){
/// Here $fragment should get "ab" value.
}
}
还有谁能告诉我如何在Kohana 3.2控制器中获得get数据?对于上面的场景,我可以通过
class Controller_Word extends Controller_Mytemplate {
public function action_startswith($fragment=null){
if($fragment==null){
/// set $fragment to $_GET['prefix'] but in Kohana way.
}
}
}
为什么不直接使用$this->request->query('prefix')呢?
http://kohanaframework.org/3.2/guide/api/Request查询