验证码路由
//验证码Route::get('captcha/:id','\\think\\captcha\\CaptchaController@index')->allowCrossDomain();Route::get('captcha','User/captcha')->allowCrossDomain();
//生成id$id = mt_rand(10000, 99999);//唯一标识符$uniqid = uniqid("$id");//返回数据,验证码图片路径,验证码标识$data = [//'src' => \think\facade\Request::domain() . captcha_src($uniqid),'src' => 'http://www.ThinkPHP.com'.captcha_src($uniqid),'uniqid' => $uniqid,];return json($data);
修改验证码存储方式