CakePHP中的图像链接

CakePHP中的图像链接,cakephp,Cakephp,我想制作一个图像链接,为此我编写了以下代码: <?php echo $this->Html->link( $this->Html->image('logo.png', array('height' => '100', 'width' => '100','escape' => false)), array('controller'=>'officers','action'=>'home')); ?>

我想制作一个图像链接,为此我编写了以下代码:

<?php echo $this->Html->link(
           $this->Html->image('logo.png', array('height' => '100', 'width' => '100','escape' => false)),
    array('controller'=>'officers','action'=>'home'));
?>

它不显示图像,而是在链接中显示以下行:

 <img src="/event_management/img/logo.png" height="100" width="100" alt="" />


链接正在运行。如何显示图像

尝试从图像中删除
escape=>false
,并在图像前添加斜杠,作为相对于
app/webroot
文件夹的斜杠,如下所示:

echo $this->Html->link(
    $this->Html->image('/<your-img-folder>/logo.png',array('height' => '100', 'width' => '100')),
    array(
        'controller' => 'zones', 
        'action' => 'index'
    ), array('escape' => false)
);
echo$this->Html->link(
$this->Html->image('//logo.png',数组('height'=>'100','width'=>'100')),
排列(
“控制器”=>“区域”,
'操作'=>'索引'
),数组('escape'=>false)
);

尝试从图像中删除
escape=>false
,并在图像前添加斜杠,作为相对于
app/webroot
文件夹的斜杠,如下所示:

echo $this->Html->link(
    $this->Html->image('/<your-img-folder>/logo.png',array('height' => '100', 'width' => '100')),
    array(
        'controller' => 'zones', 
        'action' => 'index'
    ), array('escape' => false)
);
echo$this->Html->link(
$this->Html->image('//logo.png',数组('height'=>'100','width'=>'100')),
排列(
“控制器”=>“区域”,
'操作'=>'索引'
),数组('escape'=>false)
);

更好的选择是在Html->image本身中使用url参数

$this->Html->image('logo.png', array('height' => '100', 'width' => '100','url' => array(
    'controller' => 'zones', 
    'action' => 'index'
)));

更好的选择是在Html->image本身中使用url参数

$this->Html->image('logo.png', array('height' => '100', 'width' => '100','url' => array(
    'controller' => 'zones', 
    'action' => 'index'
)));

我就是这样做到的:

$html->link($html->image('fancy-theme/appstore.png',array('height' => '27', 'width' => '94', 'alt' => 'Download on App Store')), 'https://apps.apple.com/us/app/[string]', array('id' => 'appstoredownload', 'escape' => false));

我就是这样做到的:

$html->link($html->image('fancy-theme/appstore.png',array('height' => '27', 'width' => '94', 'alt' => 'Download on App Store')), 'https://apps.apple.com/us/app/[string]', array('id' => 'appstoredownload', 'escape' => false));
@发现重复问题:@发现重复问题: