跨越与类的链接

fox*_*ns7 2 cakephp

我正在搞乱cakePHP链接标签......而且,跨度位于链接内部.

我知道escape => false,但在我看来,这并不是真的有效.php部分嵌入在'li'中,如下所示:

   <?php echo $this->Html->link($html->tag('span','Hello World'),
                                     array('controller'=>test,
                                           'action'=>index),
                                     array('class' => 'class_b'),
                                     array('escape' => false)
                                ) 

    ?>
Run Code Online (Sandbox Code Playgroud)

我的问题是,'span'标签没有从视图中"消除".我究竟做错了什么?

谢谢.

小智 5

这很简单

<?
echo $this->Html->link($this->Html->tag('span',__('News',true)),array('controller'=>'news','action'=>'index'),array('escape'=>false,'class'=>'news'));
?>
Run Code Online (Sandbox Code Playgroud)

你只需要在Html链接中添加第三个参数 escape=>false