2013-06-22 58 views
0

Iam使用html标签在cakephp中创建图片链接,我在添加src路径时遇到了问题。在cakephp中添加image src路径

我试图

<a href="#today1" id="lnk3"> 
<img src="/iserprofiles/app/webroot/img/todaysallocation.png">Todays Allocation</a> 

,但没有加载图像。如果有人知道,请回复。我知道,我们也可以使用CakePHP创建图像链接,但我遇到一个问题

IU的sed这个代码

<?php echo $this->Html->link($this->Html->image('todaysallocation.png', 
    array('width' => '200', 'height' => '45')) , 
        '#today',array('escape' => false));?> 

我不希望使用任何控制器或行动网址,只需我只是说“#今天', 但我的问题是我需要为此添加一个ID。我们怎么能做到这一点?

+3

我建议使用当地environent合适的虚拟主机设置(HTTP ://www.dereuromark.de/2011/05/29/working-with-domains-locally/)。然后你的'Html->图像'('todaysallocation.png')'会产生一个正确的src路径'/ img/todaysallocation.png',然后一旦你部署到活动服务器,它也能正常工作。 – mark

回答

1

入住您的浏览器补丁:localhost/iserprofiles/app/webroot/img/todaysallocation.png ,但我认为这个问题是在你的.htaccess文件,因为路径图像看起来就像localhost/iserprofiles/img/todaysallocation.png

+0

当我尝试访问本地主机/ iserprofiles /应用程序/ webroot/img/todaysallocation.png它显示对象未找到 – SibinF

+0

我认为,检查第二条路径 – kicaj

+0

它显示相同的错误 – SibinF