我需要打破 Yii2 验证规则中使用的长消息。
我尝试这样:
public function rules()
{
return [
['username', 'required', 'message' => 'long message first line here'."<br>".PHP_EOL.'long message last line here'],
];
}
but the <br>
出现在消息中,并且线路没有在我需要的地方中断。
需要明确的是,我得到的是:
long message first line here<br>long message last line here
and not:
long message first line here
long message last line here
有谁可以帮忙解决这个问题吗?我真的很感激!先感谢您。
我已经解决了将其添加到 ActiveForm::begin 的问题
<?php $form = ActiveForm::begin([
'fieldConfig' => [
'errorOptions' => ['class' => 'help-block', 'encode' => false],
],
]); ?>
并用一个简单的<br />
[['username'], 'required', 'message' => 'long message first line here <br />long message last line here'],
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)