蛋糕PHP。如何给出显示图片的路径
Cakephp. How to give a path to display the image
目前,我给出的路径无效。
<img src=<?= @$this->Url->build("/images/categori/{$product->thumb}") ?> alt="" class="img-fluid" width="255" height="280">
不过我想给的路径是这样的
echo $this->Html->image
尝试:
<?= $this->Html->image(sprintf('/images/categori/%s', $product->thumb),
[
'alt' => '',
'class' => 'img-fluid',
'width' => 255,
'height' => 280
]); ?>
阅读:https://book.cakephp.org/4/en/views/helpers/html.html#linking-to-images
目前,我给出的路径无效。
<img src=<?= @$this->Url->build("/images/categori/{$product->thumb}") ?> alt="" class="img-fluid" width="255" height="280">
不过我想给的路径是这样的
echo $this->Html->image
尝试:
<?= $this->Html->image(sprintf('/images/categori/%s', $product->thumb),
[
'alt' => '',
'class' => 'img-fluid',
'width' => 255,
'height' => 280
]); ?>
阅读:https://book.cakephp.org/4/en/views/helpers/html.html#linking-to-images