下面的代码将呈现一个图像:
<?= Html::img('@web/img/accept_all_you_see-wallpaper-1680x1050.jpg', ['alt' => 'PicNotFound', 'class' => 'scale-with-grid wp-post-image', 'style' => 'width:960;height:700']); ?>
下面的代码将把图像呈现为一个链接
<?= Html::a('', Yii::getAlias('@web') . '/img/pic1.jpg', ['target' => '_blank', 'alt' => 'PicNotFound', 'class' => 'icon-search']) ?>
如果我想要通过单击图像来渲染另一个Conroller方法,该如何编码?下面的代码将通过引导图标实现我的意图,而不是通过图像!
<div class="col-md-12">
<?= Html::a('<span class="glyphicon glyphicon-paperclip"></span>', ['/dateianhang/dateianhang/index'], ['title' => 'Anlagen anzeigen', 'data' => ['pjax' => '0']]); ?>
</div>
https://stackoverflow.com/questions/50728340
复制相似问题