Cakephp 如何通过Html助手(图像方法)获得img标记中图像的完整链接?

Cakephp 如何通过Html助手(图像方法)获得img标记中图像的完整链接?,cakephp,cakephp-2.1,Cakephp,Cakephp 2.1,我在电子邮件布局中有以下代码片段: <div> <?php echo $this->Html->image('Layouts/default/Logo.png', array( 'alt' => 'Setin SRL', 'url' => $this->Html->url(array('action' => 'index'), true) )); ?> </div>

我在电子邮件布局中有以下代码片段:

  <div>
    <?php echo $this->Html->image('Layouts/default/Logo.png', array(
      'alt' => 'Setin SRL',
      'url' => $this->Html->url(array('action' => 'index'), true)
    )); ?>
  </div>

然而,这是不好的。我可以通过
url(数组('action'=>'index'),true)获得网站的完整url

但我找不到任何参数,我可以设置为真的形象太。关于如何做到这一点,有什么建议或解决办法吗

编辑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));

我想这就是你要找的

<?
echo $this->Html->image(Router::url('/') . 'Layouts/default/Logo.png');
?>

$img='';
$src=preg_match('/',$img);
echo$src;

我想从img标签中获取
src
值,可能是alt值,您要查找的可能是
image
方法实现中使用的函数:

public function image($path, $options = array()) {
    $path = $this->assetUrl($path, $options + array('pathPrefix' => Configure::read('App.imageBaseUrl')));
    ...

等等,我的问题是对图片的引用,而不是链接!看我的编辑这是我的观点。你只是不使用图片和url的这种组合方式(我从来都不喜欢你可以用这种方式添加url)。PS:您可以在image()标记中执行相同的操作:
$this->Html->image($this->Html->url(…,true))
是的,但是如果我使用url方法,我将无法自动“链接”到img目录(),我必须手动添加它。我知道这是愚蠢的,但我没有使用漂亮的网址功能(主机问题),所以我得到一个。。。这显然是不好的。我把这个标记为答案,因为我发现没有其他方法。谢谢。虽然我认为您的答案在逻辑上是正确的,但我认为cake有一种缺陷,事实上它输出:/app/webroot/index.php/Layouts/default/Logo.png“index.php”显然是造成问题的原因(请记住,我禁用了托管问题的重写模块)哦,有趣的是,您能尝试Router::url('/',true)吗?这行得通吗?使用“true”我得到了不同的结果,但仍然不好:
http://www.xxx.com.localhost:8080/index.php/Layouts/default/Logo.png“
我明白了。我没意识到关闭mod_rewrite会有这种效果。你能做str_replace(“index.php”,”,Router::url(“/”,true))吗?”-那应该行。是的,奥比乌斯,但我希望有一个已经行得通的东西。我已经按照你的建议解决了:(我相信这在我处理这个问题时是不可用的。)
public function image($path, $options = array()) {
    $path = $this->assetUrl($path, $options + array('pathPrefix' => Configure::read('App.imageBaseUrl')));
    ...