xhh
- xhh 回答了问题 自定义rules验证提示
有两种解决方法:
1、用验证规则验证
在模型的验证规则中加入 ['recipient', 'exist', 'message' => '没有该收件人,请重新确认'],
2、使用的自定义验证规则
['recipient', 'validateRecipient'],
public function validateRecipient($attribute, $params)
{if(!$this->hasErrors()){ $data=Member::find()->where(['username'=>$this->recipient])->one(); if(is_null($data)){ $this->addError($attribute,'没有该收件人,请重新确认'); } }
}
- xhh 回复了 zhoupenghui 的回答
你打印一下错误信息呢,
Array ( [verifyCode] => Array ( [0] => 验证码不正确。 ) )
显示的这个错误
但我没用到验证码呀
我把验证码加上场景就好了['verifyCode', 'captcha', 'captchaAction' => '/appfront/login/captcha', 'on' => 'reg'],
但还是不明白哪里用到验证码了 - xhh 收藏了教程yii2分页的基本使用及其配置详解
- xhh 2016-12-28 已签到连续签到2天,获得了10个金钱
- xhh 评论了教程 解决Yii2中刷新网页时验证码不刷新的问题
Thanks