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

Is it possible to add a link in the validation rule of a unique email?

在我的模型中:

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."
    ));
}

我能以某种方式取消 link 的转义吗?

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

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

<?=
$this->Form->control("email", [
    "label" => "Your email",
    "error" => [
        "escape" => false
    ]
])
?>