cakephp 从 post 获取图像的 url
cakephp get the url of image from post
我会得到图像 url: mysite/img/test.png
但我得到这个 link: mysite/posts/test.png
<?php echo $this->Html->link(
$this->Html->image($post['Post']['image']),
$post['Post']['title']),
array('escape' => false)
);
?>
我必须换个方式 url?
编辑:
如果你想link你的形象,你可以这样做。
<?php echo $this->Html->link(
$this->Html->image($post['Post']['image']),
$this->Html->url('/img/'.$post['Post']['image']),
array('escape' => false)
);
?>
或
<a href="<?php echo $this->Html->url('/img/'.$post['Post']['image']); ?>">
<?php echo $this->Html->image($post['Post']['image']); ?>
</a>
我会得到图像 url: mysite/img/test.png
但我得到这个 link: mysite/posts/test.png
<?php echo $this->Html->link(
$this->Html->image($post['Post']['image']),
$post['Post']['title']),
array('escape' => false)
);
?>
我必须换个方式 url?
编辑:
如果你想link你的形象,你可以这样做。
<?php echo $this->Html->link(
$this->Html->image($post['Post']['image']),
$this->Html->url('/img/'.$post['Post']['image']),
array('escape' => false)
);
?>
或
<a href="<?php echo $this->Html->url('/img/'.$post['Post']['image']); ?>">
<?php echo $this->Html->image($post['Post']['image']); ?>
</a>