<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'time',
'pic',
],
]) ?>

是首页展示的几个测试字段 , pic 是本地数据库图片的路径 , 这时候首页显示的是

yii 图片展示

要显示图片就把'pic'换成

[
    'attribute'=>'pic',
    'format' => 'raw',
    'value' => function($model){
        return Html::img($model->pic);
    }

],如果你的图片地址没有问题就可以显示了

 


 
                    
            
                

相关文章:

  • 2021-12-31
  • 2022-01-10
  • 2021-07-20
  • 2021-06-16
  • 2021-07-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-18
  • 2021-10-27
  • 2022-12-23
  • 2021-09-05
  • 2022-12-23
  • 2021-06-04
相关资源
相似解决方案