image - 无法使用 yii2 在滑块中显示图像
问题描述
我有代码来显示这样的视图
<div class="col-md-10">
<div class="col-md-4">
<?php
$items = [];
foreach ($team->gallery as $item){
$items[] = [
'content' => '<img style="width:300px;" src="'.$item->filepath.'"/>',
'caption' => '<h4>'.$item->name.'</h4><p>'.$item->description.'</p>',
];
}
echo Carousel::widget([
'items' => $items,
]);
?>
</div>
和像这样获取画廊的模型
public function getLeague(){
return $this->hasOne(Leagues::className(), ['id' => 'league_id']);
}
public function getGallery(){
return $this->hasMany(TeamGalleries::className(), ['team_id' => 'id']);
}
但是我无法在我的数据库中获取文件路径,因此我无法在我的网站上显示我的图片,如何解决这个问题?
我使用 yii2,我的图片上传的文件夹在 yii2 basic 的 web 文件夹中