Yii2中radioList

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:36:231958browse

代码如下:
= $form->field($model, 'status')->radioList(['0'=>'有效','1'=>'无效'],['class'=>'label-group'])->label('状态'); ?>

我如何在选项中添加首选参数,看了源码好像没发现?label('状态',[参数])这里加$options好像也没用。

回复内容:

代码如下:
= $form->field($model, 'status')->radioList(['0'=>'有效','1'=>'无效'],['class'=>'label-group'])->label('状态'); ?>

我如何在选项中添加首选参数,看了源码好像没发现?label('状态',[参数])这里加$options好像也没用。

你所谓的首选参数是指radioList的默认选中的radio么?如果是,只需设置$model->status = 1就可以默认选中“无效”了。异或是你这里的首选参数指的是别的?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn