添加图标到 link cakephp 2
Add icon to a link cakephp 2
我想向 Cakephp link 添加一个图标 <i>
标签。
这是我的代码:
<?= $this->Html->link($this->Html->tag('i', '', array('class' => 'fa fa-shopping-cart')).'Cart', array('controller' => 'shop', 'action' => 'cart')) ?>
此行生成:
<a href="/cakephp-shopping-cart/shop/cart"><i class="fa fa-shopping-cart"></i>Cart</a>
为什么 <
被它的六进制值取代了?我的字符集是 UTF-8。
谢谢!
添加选项 'escape'
设置为 false
:
<?= $this->Html->link($this->Html->tag('i', '', array('class' => 'fa fa-shopping-cart')).'Cart', array('controller' => 'shop', 'action' => 'cart'), array('escape' => false)) ?>
关于 HtmlHelper
的文档页面。
Html->link($this->Html->tag('i', '',['class' => 'fa fa-shopping-cart']) .'Cart',['controller' => 'shop', 'action' => 'cart'], ['escape' => false]); ?>
我想向 Cakephp link 添加一个图标 <i>
标签。
这是我的代码:
<?= $this->Html->link($this->Html->tag('i', '', array('class' => 'fa fa-shopping-cart')).'Cart', array('controller' => 'shop', 'action' => 'cart')) ?>
此行生成:
<a href="/cakephp-shopping-cart/shop/cart"><i class="fa fa-shopping-cart"></i>Cart</a>
为什么 <
被它的六进制值取代了?我的字符集是 UTF-8。
谢谢!
添加选项 'escape'
设置为 false
:
<?= $this->Html->link($this->Html->tag('i', '', array('class' => 'fa fa-shopping-cart')).'Cart', array('controller' => 'shop', 'action' => 'cart'), array('escape' => false)) ?>
关于 HtmlHelper
的文档页面。