/**
* 校验验证码
*
* @param bool $isCn 是否为中文验证码
* @param string $input 用户输入
* @param string $verifyName 生成验证码时的字段
*
* @return bool 正确返回true,错误返回false
*/
public static function checkCode($input, $isCn = false, $verifyName = 'verifyCode')
{
$key = \Cml\Http\Cookie::get($verifyName);
if (!$key) {
return false;
}
$code = \Cml\Model::getInstance()->cache()->get($key);
\Cml\Model::getInstance()->cache()->delete($key);
$isCn && ($input = md5(urldecode($input)));
if ($code === false || $code != $input) {
return false;
} else {
return true;
}
}