40, // 验证码位数 'length' => 4, // 关闭验证码杂点 'useNoise' => false, ]; config($config, 'captcha'); $captcha = Captcha::create(); return $captcha; } /** * @api {POST} api/Seccode/check 检查验证码 * @apiVersion 1.0.0 * @apiGroup Seccode * * @apiParam {String} captcha 验证码 * * @apiSuccess {String} code 返回码,10000为成功 * @apiSuccess {String} message 返回消息 * @apiSuccess {Object} result 返回数据 */ public function check() { $captch = input('param.captcha'); if (captcha_check($captch)) { ds_json_encode(10000, ''); } else { ds_json_encode(10001, '验证码错误', ['code' => '']); } } }