在视图层index.php展示代码中加入
1 [ 2 'attribute' => 'file',//字段名 3 'format' => 'raw', 4 'value' => function($model){ 5 return '<img width="70px" src="'.$model->file.'">'; 6 } 7 ]
attribute为字段名$model->file为你数据库中的路径