YII GET方式参数重复/叠加的解决办法

表单代码如下

$form = ActiveForm::begin([
    'id' => 'search-form',
    'method' => 'get',
]);
echo $form->field($Model, 'id');
echo Html::submitButton('查询', ['class' => 'btn btn-primary']);
ActiveForm::end();

解决办法很简单,就是为表单添加一个action属性就欧了.修改后的代码如下

$form = ActiveForm::begin([
    'id' => 'search-form',
    'method' => 'get',
    'action'=>$this->creatUrl('site/search'),
]);
echo $form->field($Model, 'id');
echo Html::submitButton('查询', ['class' => 'btn btn-primary']);
ActiveForm::end();

 222

猜你喜欢

转载自hudeyong926.iteye.com/blog/2265894
yii