[moka同学笔记]四、Yii2.0课程笔记(魏曦老师教程)[匿名函数的使用操作]
在评论页面中index.php中
[ 'attribute'=>'status', 'value'=>'status0.name', 'filter'=>Commentstatus::find()->select(['name','id'])->orderBy('position')->indexBy('id')->column(), 'contentOptions'=>function($model){ //此处使用匿名函数来判断状态,设定状态的样式 return ($model->status==1)?['class'=>'bg-danger']:[]; } ],
我生活的地方,我为何要生活。