使用cakephp如何在foreach循环中显示存储在数据库中的图像?
我是Cakephp新手,我想知道如何在foreach循环中从数据库中回显图像? 我该怎么做?正确的方法是什么? 我的所有图像都在webroot文件夹中使用cakephp如何在foreach循环中显示存储在数据库中的图像?,php,database,loops,cakephp,foreach,Php,Database,Loops,Cakephp,Foreach,我是Cakephp新手,我想知道如何在foreach循环中从数据库中回显图像? 我该怎么做?正确的方法是什么? 我的所有图像都在webroot文件夹中 <?php if ( isset($beefwellington) ){ ?> <?php foreach ($beefwellington as $wellington): ?> <h1><?php echo $wellington['Beef']['genre']; ?&
<?php if ( isset($beefwellington) ){ ?>
<?php foreach ($beefwellington as $wellington): ?>
<h1><?php echo $wellington['Beef']['genre']; ?></h1>
<h2><?php echo $wellington['Beef']['story']; ?></h2>
<?php endforeach; ?>
<?php } ?>
这就是我所尝试的:
<?php echo $html->image('app/webroot/img' .$wellington['Beef']['picture'], array('alt' => 'story image'));
如果你在app/webtoot/img文件夹中有你的图像,那么你只需要这样写:
<?php echo $this->Html->image($wellington['Beef']['picture'], array('alt' => 'story image')); ?>
我在您的代码示例中没有看到任何图像。你试了什么?数据库里有什么?实际的原始图像数据?还是图像的URL?还是文件名?