如何通过HTML帮助器(图像方法)获得指向img标签中图像的完整链接? [英] How can I get full link to an image in the img tag through the Html helper (image method)?
本文介绍了如何通过HTML帮助器(图像方法)获得指向img标签中图像的完整链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在电子邮件布局中有以下代码段:
I have this code snippet in an email layout:
<div>
<?php echo $this->Html->image('Layouts/default/Logo.png', array(
'alt' => 'Setin SRL',
'url' => $this->Html->url(array('action' => 'index'), true)
)); ?>
</div>
但是,这不行。我可以通过 url(array('action'=>'index'),true)进入网站的完整url
However this is not ok. I can get the FULL url to the website through url(array('action' => 'index'), true)
但是我也找不到任何可以设置为true的参数。有关如何执行此操作的任何建议或解决方法?
But I can't find any paramater that I can set to true for image too. Any suggestion or workaround on how can I do this?
编辑1:
基本上,我需要以下链接: Layouts / default / Logo.png
成为 http://www.something.com/Layouts/default/Logo.png
img src
推荐答案
我总是使用
$this->Html->link($this->Html->image(...), $this->Html->url(array('action' => 'index'), true), array('escape'=>false));
这篇关于如何通过HTML帮助器(图像方法)获得指向img标签中图像的完整链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文