有没有办法根据请求参数实现路由?例如,
/v1/articles - action `serve_articles`
/v1/articles?type=list - action `server_filtered_by_list`
答案 0 :(得分:2)
The simplest way form me is this
you can add to you (eg: index) action the param you need for you purpose
public function actionIndex($type, $param2, $param3)
{
... then your code inclus the call for action in controller or
.... redirect or
.... render
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}