view中代码如下:img为model中的字段
<?= GridView::widget([
'model' => $model,
'tableOptions'=>['class'=>'table table-striped table-hover'],
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'id',
[
'attribute'=>'img',
'format' => ['image',['width'=>'30','height'=>'30',]],
],
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
判断img属性是否为空,根据结果输出图片或提示
你好,这个$model是哪儿来的啊,我的怎么是未定义????