Yii框架上传后展示图片

在视图层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为你数据库中的路径

原文地址:https://www.cnblogs.com/BrokenHeart/p/10614635.html