我尝试使用 FormHelper..in cakephp 制作带有链接的图像。下面是我的脚本:
<?php
echo $this->Html->link($this->Html->image('images/view-more-arrow.png') . ' ' . __('View More'),array('controller' => 'zones', 'action' => 'index'), array('escape' => false));
?>
输出:
<a href="/project_folder/trunk/zones"><img src="/project_folder/trunk/img/images/view-more-arrow.png" alt=""> View More</a>
预计:
<a href="/project_folder/trunk/zones"><img src="/project_folder/trunk/images/view-more-arrow.png" alt=""> View More</a>
我的图像目录路径是 project_folder/app/webroot/images。我不知道为什么它需要 img/ 自动。
先感谢您..
我引用了这个链接: Cakephp html link with image + text, without using css