验证码接口api
作者:互联网
路由:
Route::get('captcha/:id', "\\think\\captcha\\CaptchaController@index")->allowCrossDomain();
Route::get('captcha', 'blog/captcha')->allowCrossDomain();
方法:
public function captcha(Request $request)
{
$id = mt_rand(100000, 999999);
$uniqId = uniqid("$id");
$data = [
'src' => $request->domain(). captcha_src($uniqId),
'uniqId' => $uniqId
];
return success($data);
}
标签:allowCrossDomain,get,Route,验证码,接口,captcha,api,id,uniqId 来源: https://blog.csdn.net/Neverdrophair/article/details/121598098