我在本地测试验证码,是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 ->ba
se ->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);
}
不知道为什么就是不行,求助大家