我正在尝试使用以下结构在cakephp中实现图片库:
echo $this->Html->link(
$this->Html->image('gallery/fashion/fashion-photography-guwahati-'.$i.'.jpg',
array('class'=>'img img-responsive')
),
'gallery/fashion/fashion-photography-guwahati-big-'.$i.'.jpg',
array(
'class' => 'col-sm-4',
'escape' => false,
'data-toggle' => 'lightbox',
'data-gallery' => 'multiimages',
)
);
但上面的脚本会输出HTML
:
<a href="/nitish/cakem/galleries/gallery/fashion/fashion-photography-guwahati-big-4.jpg" class="col-sm-4" data-toggle="lightbox" data-gallery="multiimages">
<img src="/nitish/cakem/img/gallery/fashion/fashion-photography-guwahati-4.jpg" class="img img-responsive" alt="" />
</a>
正如您在anchor
路径中所看到的,添加了额外的galleries
目录。如何删除?
注意:galleries
是我的控制器名称
答案 0 :(得分:1)
用斜线描述你的路径:
echo $this->Html->link(
$this->Html->image('/gallery/fashion/fashion-photography-guwahati-'.$i.'.jpg',
array('class'=>'img img-responsive')
),
'/gallery/fashion/fashion-photography-guwahati-big-'.$i.'.jpg',
array(
'class' => 'col-sm-4',
'escape' => false,
'data-toggle' => 'lightbox',
'data-gallery' => 'multiimages',
)
);