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

时间:2018-03-02 09:12:26

标签: cakephp cakephp-3.0

在我的模型中:

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

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

不知何故,按类型:&#39;逃避&#39; =&GT;在视图中是假的吗?

1 个答案:

答案 0 :(得分:1)

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

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