如何在 cakephp3 中将 html 放置在标签内?
我需要实现 * 姓名:
使用下面的代码
<?php
echo $this->Form->input ( 'name', [
'label' => [
'text' => '<span class="red">*</span> Name:',
'class' => 'col-sm-12 col-md-2 col-lg-1 control-label'
],
'class' => 'form-control',
'rows' => 1
] );
最佳答案
与往常一样,使用 escape
option .
echo $this->Form->input('name', [
'label' => [
// ...
'escape' => false
],
// ...
]);
关于Cakephp3 : Render/Evaluate HTML inside label formhelper,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27991447/