/**
* 验证码生成
* @access
* @author:ss.wu
*/
public function code(){
ob_clean();
$config = array(
'fontSize' => 25, // 验证码字体大小
'length' => 3, // 验证码位数
'useNoise' => true, // 验证码杂点
'useCurve' => false, // 线条
'imageW' => 150,
'imageH' => 48,
);
$Verify = new \Think\Verify($config);
// $Verify->codeSet = '0123456789';
$Verify->entry();
}
/**
* 验证码验证
* @access
* @param $code
* @param string $id
* @return bool
* @author:ss.wu
*/
public function check_verify($code, $id = ''){
$verify = new \Think\Verify();;
return $verify->check($code, $id);
}
public function login(){
$code = I('post.code');
if(!$this->check_verify($code)){
$this->error('验证码输入错误');
}
} 最佳答案