这是Laravel方式的链接生成
{{ HTML::link('http://test.com', 'testing')}}
这是替代
<a href="http://test.com">testing</a>
这是以拉拉维尔方式生成的图像
{{ HTML::image('img/picture.jpg', 'a picture', array('class' => 'thumb')) }}
哪个是替代方案
但是我该如何创建
<a href="http://your.url/img/picture.jpg">
<img src="http://your.url/img/picture.jpg" class="thumb" alt="a picture">
</a>
这样我就可以生成一个包含图像的 HTML 链接,而不是其中只有文本。
我该怎么做?
更新:
$img='a.jpg';
<a href="assets/uploads/prsdk/" target="_blank">{{ HTML::image('assets/uploads/prsdk/'.$img, 'alt', array( 'width' => 35, 'height' => 35 )) }}</a>
对于静态链接
<a href="#"><img src={{asset('img/logo.png')}} alt="Logo"></a>
对于动态链接
<a href="{{URL::to('/')}}"><img src={{asset('img/logo.png')}} alt="Logo"></a>
你可以自己写标签,在href/src中你可以使用laravel route('route.name')
和asset('img_path/img_name.png')
。
但是,如果您仍然想使用 HTML
类来实现这一点,则以下代码将起作用。
{{ html_entity_decode(HTML::link('test.com',HTML::image('img/picture', 'a picture', array('class' => 'thumb')))) }}