captcha验证码始终无效

浏览:2704 发布日期:2019/11/24 分类:求助交流
我在本地测试验证码,是ok的。但是在前端那里,就是提示验证码无效
对方代码是vue,由于有跨域,我在本地上加上了
//加入了允许跨域访问
header("Access-Control-Allow-Origin:*");
header("Access-Control-Allow-Methods:GET, POST, OPTIONS, DELETE");
header("Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Accept-Language, Origin, Accept-Encoding");
/**
* 获取图片验证码
*/
public function getImageAuthCode(){
ob_clean();
$param = $this ->base ->decrypt();
$timestamp = $param['timestamp']; //获得手机号
$config = Config::get('captcha');
$captcha = new Captcha($config);
return $captcha->entry($timestamp);
}
/*
* 验证验证码
* **/
public function check_verify(){
$param = $this ->base ->decrypt();
$verify = $param['verify']; //获得验证码
$timestamp = $param['timestamp']; //获得手机号
if( !cmf_captcha_check($verify,$timestamp))
{
$return['code'] = 2;
$return['msg'] = '验证码已过期';

}else{
$return['code'] = 1;
$return['msg'] = '验证码成功';
}
$this ->base ->encrypt($return);
}

不知道为什么就是不行,求助大家
最佳答案
评论( 相关
后面还有条评论,点击查看>>