如何在锚标签和img标签中使用class

How to use class in anchor tag and img tag

 <a href="images/xyz.jpg" class="swipebox"><img src="images/abc.jpg" class="img-style row2"></a>.  

我必须在 cakephp3 中使用上面的代码。我已经尝试使用 html 帮助程序,但我的代码存在一些语法错误。

这是我的代码,

<?php echo $this->Html->link('".$this->Html->image('abc.jpg', ['class' => 'img-style row2'])."', $this->Html->image('xyz.jpg', ['class' => 'swipebox'])); ?>

请帮助任何人解决这个问题。

使用图像方法进入 link 方法然后使用 'escape' => false,参见示例

echo $this->Html->link(
              $this->Html->image('img.jpg',['class'=>'img-class','alt'   => 'img',]),
              ['controller'=>'', 'action'=>''],
              ['escape' => false,'class'=>'link-class'] 
);