我为yii2高级设置了漂亮的网址 在config / main.php
'urlManager' => [
'class'=>'yii\web\UrlManager',
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'/' => 'site/index',
],
],
的.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
某个控制器
$searchModel = new UserSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
但是来自gridView $ searchModel的查询过滤器仍然很脏,我可以像一些/ action一样漂亮吗?name = jack& shift_id = 1没有UserSearch [name] = jack?
some/action?UserSearch%5Bname%5D=jack&UserSearch%5Bshift_id%5D=1&UserSearch%5Bmanager_id%5D=176