是否可以在唯一电子邮件的验证规则中添加链接?

问题描述 投票:2回答:1

在我的模型中:

public function buildRules(RulesChecker $rules)
{
    return $rules->add($rules->isUnique(
        ['email'], 
        "This email is already registered on the site. If it's yours, then you can restore access by clicking on the link <a href='#'>Restore access</a> and follow the instructions."
    ));
}

我可以以某种方式取消链接的转义吗?

不知何故,按类型:'escape'=> false在视图中?

cakephp cakephp-3.0
1个回答
1
投票

要禁用转义的错误消息,您需要在FormHelper::control()中的错误选项中指定escape => false:

<?=
$this->Form->control("email", [
    "label" => "Your email",
    "error" => [
        "escape" => false
    ]
])
?>
© www.soinside.com 2019 - 2024. All rights reserved.