Php Html标记在Yii2中的模型属性标签内不起作用
Html标记在Yii2中的模型属性标签内不起作用Php Html标记在Yii2中的模型属性标签内不起作用,php,forms,activerecord,yii2,Php,Forms,Activerecord,Yii2,Html标记在Yii2中的模型属性标签内不起作用 public function attributeLabels() { return [ 'name'=>' Name <br> Age', ]; } 上面的一个是实际代码….$form->field($model,'termsofuse')) $form->field($model, 'termsofuse') ->checkbox
public function attributeLabels() {
return [
'name'=>' Name <br> Age',
];
}
上面的一个是实际代码….$form->field($model,'termsofuse'))
$form->field($model, 'termsofuse')
->checkbox(['label' => Yii::t('app', 'I understand and agree to the <a href="#termsofuse">Terms of Use</a>.')])
->label(false);
->复选框(['label'=>Yii::t('app','I理解并同意'.'))
->标签(假);
更多信息,请正确缩进代码,这很难理解。当然,我现在已经编辑过了。请尝试使用
\n
而不是并将您的值用双引号而不是单引号括起来这是什么原因?为什么标签上有两个名称,如
Name
和Age
?假设实体的每个属性都有一个标签。模型中不应该有任何html属性。这必须在视图文件中处理。尝试过了,\n标记没有出现在UI中,但它没有中断线路,但不会出现在验证消息中,如下面所示,“我理解并同意不能为空”。。它附带了HTML标签
$form->field($model, 'termsofuse')
->checkbox(['label' => Yii::t('app', 'I understand and agree to the <a href="#termsofuse">Terms of Use</a>.')])
->label(false);