前台输入的验证码,已经通过I函数传到后台的ThinkPHP的方法中来了,接下来呢,怎么验证输入的这个验证码是否正确?
前台代码如下:
后台的verifyImg方法如下:
前台的验证码输入框有keyup函数:
后台的rcvTxtVerCod方法:
还是不明白。。。。糊涂了,我把前台由用户输入的验证码传到后台了,接下来怎么验证呢?
这次的这个问题我是帮不了你了,C#的话我倒是可以发代码给你。
public ActionResult CheckVcode(LoginInfo model)
{
//取出Session中的验证码
string vcodeStr = Session[Keys.Vcode] == null ? string.Empty : Session[Keys.Vcode].ToString();
//做忽略大小写的比较
if (vcodeStr.Equals(model.Vcode, StringComparison.OrdinalIgnoreCase))
{
return Content("yes");
}
else
{
return Content("no");
}
}
function check_verify($code, $id = ''){
$verify = new \Think\Verify();
return $verify->check($code, $id);}
验证码是这样验证的 ajax传过去 这里会返回 true或者false的
记得好像是session('verify')==Md5(I(verify))
手机码不方便