如何在 cakephp 3.2 锚标记中包含 html 元素?
How to include a html element in cakephp 3.2 anchor tag?
这里我想在 cakephp 3.2 锚 link 中包含一个 html 元素。
我试过了,但它不是 working.Below 是代码。
<?= $this->Html->link(__('<i class="fa fa-eye"></i>'), ['action' => 'edit', $user->id],['class'=>"btn btn-primary"]) ?>
我想要下面 html 的蛋糕格式。
<a class="btn btn-primary" href="/adminCake3/adminCake3/users/edit/3"><i class="fa fa-eye"></i></a>
这里代替图标,html tag() 是coming.Thank你提前
HTML special characters in $title will be converted to HTML entities.
To disable this conversion, set the escape option to false in the
$options array.
Setting escape to false will also disable escaping of attributes of
the link.
试试这个
echo $this->Html->link(
$this->Html->tag('i','',array('class'=>'fa fa-eye')),
'/adminCake3/adminCake3/users/edit/'.$user->id,
['escape' => false,'class' => 'btn btn-primary']
);
或
echo $this->Html->link(
'<i class="fa fa-eye"></i>',
'/adminCake3/adminCake3/users/edit/'.$user->id,
['escape' => false,'class' => 'btn btn-primary']
);
用户此方法:
<?= $this->Html->link(__('<i class="fa fa-eye"></i>'), ['action' => 'edit', $user->id],['class'=>"btn btn-primary"],['escape'=>false]) ?>
做你的主播link
$this->Html->link('<i class="fa fa-eye"></i> Edit', ['action' => 'edit', $user->id],['escape'=>false,'class'=>'btn btn-xs btn-primary']);
这是工作代码。
这里我想在 cakephp 3.2 锚 link 中包含一个 html 元素。 我试过了,但它不是 working.Below 是代码。
<?= $this->Html->link(__('<i class="fa fa-eye"></i>'), ['action' => 'edit', $user->id],['class'=>"btn btn-primary"]) ?>
我想要下面 html 的蛋糕格式。
<a class="btn btn-primary" href="/adminCake3/adminCake3/users/edit/3"><i class="fa fa-eye"></i></a>
这里代替图标,html tag() 是coming.Thank你提前
HTML special characters in $title will be converted to HTML entities. To disable this conversion, set the escape option to false in the $options array.
Setting escape to false will also disable escaping of attributes of the link.
试试这个
echo $this->Html->link(
$this->Html->tag('i','',array('class'=>'fa fa-eye')),
'/adminCake3/adminCake3/users/edit/'.$user->id,
['escape' => false,'class' => 'btn btn-primary']
);
或
echo $this->Html->link(
'<i class="fa fa-eye"></i>',
'/adminCake3/adminCake3/users/edit/'.$user->id,
['escape' => false,'class' => 'btn btn-primary']
);
用户此方法:
<?= $this->Html->link(__('<i class="fa fa-eye"></i>'), ['action' => 'edit', $user->id],['class'=>"btn btn-primary"],['escape'=>false]) ?>
做你的主播link
$this->Html->link('<i class="fa fa-eye"></i> Edit', ['action' => 'edit', $user->id],['escape'=>false,'class'=>'btn btn-xs btn-primary']);
这是工作代码。