Home > Backend Development > PHP Tutorial > Yii2中radioList

Yii2中radioList

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:36:23
Original
1960 people have browsed it

代码如下:
= $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就可以默认选中“无效”了。异或是你这里的首选参数指的是别的?

Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
yii2 error connecting to mongodb3.2.4
From 1970-01-01 08:00:00
0
0
0
How to use mongodb to do rbac in yii2
From 1970-01-01 08:00:00
0
0
0
php - yii2-ueditor-widget
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template