Yii2.0去掉、隐藏form表单中的label标签
腾讯云服务器低至38元/年,最新活动入口戳: https://curl.qcloud.com/HDDBWVuJ
第一种方式
将label的值设置为false:
<?= $form->field($model, 'city_id')->dropDownlist(ArrayHelper::map(
Addressservice::getCityList($model->province_id),'city_id','city_name'),['prompt'=>'请选择城市'],['style'=>'width:150px;'])
->label(false)?>
第二种方式
设置labelOptions属性:
<?= $form->field($model, 'city_id',['labelOptions'=>['class'=> 'hide']])->dropDownlist(ArrayHelper::map(
Addressservice::getCityList($model->province_id),'city_id','city_name'),['prompt'=>'请选择城市'],['style'=>'width:150px;'])?>

扫码添加站长好友
多年IT从业经验
涉及网络、机房、服务器、网站建设等领域