2
我试图从cakephp中的webroot查看图像。 但是我没有得到任何图像。请帮帮我;如何在webroot中查看图像
这段代码正确
$this->Html->image('WWW_ROOT . img/upload/aswq.png', array('width'=>'200px'));
我试图从cakephp中的webroot查看图像。 但是我没有得到任何图像。请帮帮我;如何在webroot中查看图像
这段代码正确
$this->Html->image('WWW_ROOT . img/upload/aswq.png', array('width'=>'200px'));
,你可以用这种方式来显示从根目录文件夹中的图像使用。只是注意到img
文件夹已经在html
帮手包含的路径
echo $this->Html->image('upload/aswq.png', array('width' => '200px','alt'=>'aswq'));
将输出:
<img src="/img/upload/aswq.png" alt="aswq" />
让我知道如果我能帮助你。
如果照片位于不同的文件夹中,该怎么办?根目录/文件 –