我尝试使用灯箱,我按照此link中的所有步骤操作,但代码中存在问题
<a href="images/image-1.jpg" rel="lightbox">
<img src="images/thumb-1.jpg" width="100" height="40" alt="" />
</a>
我把图片文件夹放在webroot
中C:\wamp\www\tet\app\webroot\img\images
而不是上面的代码我使用
$thumb = $this->Html->image('images/thumb-1.jpg');
$full = $this->Html->image('/images/image-1.jpg', array('rel' => 'lightbox'));
echo $this->Html->link($thumb,$full, array('escape' => false));
但我仍然看到此错误
Missing Method in ImagesController
Error: The action <img src=" is not defined in controller ImagesController
Error: Create ImagesController::<img src="() in file: app\controllers\images_controller.php.
<?php
class ImagesController extends AppController {
var $name = 'Images';
function <img src="() {
}
}
?>
任何帮助,请
答案 0 :(得分:0)
因为你做错了。它应该像
$this->Html->image('images/thumb-1.jpg', array('url' => 'images/image-1.jpg'));