GridView::widget()图片展示
- 直接上代码
[
'label' => '图标',
"format"=>'raw',
'value' => function($model) {
return Html::img($model->image,["width"=>"84","height"=>"84"]);
},
],
[
"label" => "头像",
"format" => [
"image",
[
"width"=>"84",
"height"=>"84"
]
],
"value" => function ($model) {
return $model->image;
}
]
上面两种方式都能达到效果,只是会有一点小差别