cakephp链接图像以查看


cakephp link image to view

我想链接以下图像:

echo '<img src="'.Configure::read('CDN').'/img/'.Configure::read("Config.language").'/my_bird.png" alt="Bird" />';

到此视图:

<a href="<?=$this->Html->url(array('controller' => 'birds', 'action' => 'view'))?>">

我该怎么做?我看到了echo$this->Html->link的例子,但我不确定在这种情况下如何做到这一点。

您需要使用echo $this->Html->image();

    echo $this->Html->image(Configure::read('CDN') . '/img/' . Configure::read("Config.language") . '/my_bird.png', array(
        "alt" => "Bird",
        'url' => array('controller' => 'birds', 'action' => 'view')
    ));