Yii2.0 的多选框实现方法

下面介绍一下 Yii2.0 的 多选框实现方法

第一种:ActiveForm::checkboxList(); 优点:可以将全部数据生成多选框,自带验证

$form->field($model, 'username')->checkboxList(ArrayHelper::map($data,'id', 'customer_name'));

第二种:ActiveForm::checkbox(); 优点:只生成一个多选框,自带验证

$form->field($model, 'username')->checkbox(ArrayHelper::map($data,'id', 'customer_name'));

第三种:Html::activeCheckbox();

Html::activeCheckbox($model, 'username', ArrayHelper::map($data,'id', 'customer_name'));

第四种:Html::activeCheckboxList();

Html::activeCheckboxList($model, 'username', ArrayHelper::map($data,'id', 'customer_name'));
微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_2499.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?