我使用Yii2表格,提交后,我的网址如下:
http://example.com/recommendations/index?RecommendationSearch%5Bname%5D=&RecommendationSearch%5Bstatus_id%5D=&RecommendationSearch%5Btype%5D=0&RecommendationSearch%5Bcreated_at%5D=&sort=created_at
您似乎似乎每个参数都包含表单名称RecommendationSearch
。如何从参数中删除此RecommendationSearch
以获取如下所示的URL URL:
http://example.com/recommendations/?name=&status_id=&type=0&created_at=&sort=created_at
答案 0 :(得分:2)
您需要在RecommendationSearch
模型中覆盖formName()
以返回空字符串:
public function formName() {
return '';
}