Cakephp的图像转义链接不工作

cakephp link on image escape is not working

本文关键字:工作 链接 转义 图像 Cakephp      更新时间:2023-09-26

cakephp中的图像链接不工作

$this->Html->link(  
      $this->Html->image('image',array('class' => $class,
                'id' =>'img_id' )), somelink, array('onclick' =>'jQuery(this).modal({width:600,height:400,left:120,top:100}).open(); return false;'),
                                        array(),
                                        array('escape'=>false));

它将输出

<a href='link' onclick='jQuery(this).modal({width:600,height:400}).open(); return false;'> &lt; img src='image_path' &gt;   

没有转义&lt和>即使我提到escape=>false,但我没有得到我失踪的地方吗?

你争论太多了。试试这个:

echo $this->Html->link(  
  $this->Html->image('image',array('class' => $class,
            'id' =>'img_id' )), 'foo', array('escape'=>false, 'onclick' =>'jQuery(this).modal({width:600,height:400,left:120,top:100}).open(); return false;')
);
echo $this->Html->link(  
 $this->Html->image('image',array('class' => $class,
        'id' =>'img_id' )), '#', array('escape'=>false, 'onclick' => 'jQuery(this).modal({width:600,height:400,left:120,top:100}).open(); return false;','class'=>'linkclass'));