1.安装
composer require mews/captcha
2.获取验证码接口
$data = Captcha::create('default', true); return $this->success($data);
3.验证接口
//用户输入的验证码内容 $code = 'czuu'; //获取验证码接口返回的key $key = '$2y$10$QcWWDaSscrJTxHYqxVQR/.OQxEBy20yA6cYmxeJTQjGZKqm3kBuOG'; if (!captcha_api_check($code, $key)) { return $this->fail(500, '验证码有误'); } return $this->success();
标签:laravel,code,return,分离,验证码,接口,captcha,key From: https://www.cnblogs.com/CanyingV/p/17612849.html