将图标添加到链接cakephp 2

Ty *_* Yt 1 php cakephp cakephp-2.0

我想<i>在Cakephp链接中添加一个图标标签.这是我的代码:

<?= $this->Html->link($this->Html->tag('i', '', array('class' => 'fa fa-shopping-cart')).'Cart', array('controller' => 'shop', 'action' => 'cart')) ?>
Run Code Online (Sandbox Code Playgroud)

这一行生成:

<a href="/cakephp-shopping-cart/shop/cart">&lt;i class="fa fa-shopping-cart"&gt;&lt;/i&gt;Cart</a>
Run Code Online (Sandbox Code Playgroud)

为什么<被其hexa值取代?我的字符集是UTF-8.

谢谢!

mar*_*an0 9

添加选项'escape'设置为false:

<?= $this->Html->link($this->Html->tag('i', '', array('class' => 'fa fa-shopping-cart')).'Cart', array('controller' => 'shop', 'action' => 'cart'), array('escape' => false)) ?>
Run Code Online (Sandbox Code Playgroud)

关于的文档页面HtmlHelper.