1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace app\api\controller;
- use think\captcha\facade\Captcha;
- class Seccode extends MobileMall
- {
-
- public function makecode()
- {
- $config = [
-
- 'fontSize' => 40,
-
- 'length' => 4,
-
- 'useNoise' => false,
- ];
- config($config, 'captcha');
- $captcha = Captcha::create();
- return $captcha;
- }
-
- public function check()
- {
- $captch = input('param.captcha');
- if (captcha_check($captch)) {
- ds_json_encode(10000, '');
- } else {
- ds_json_encode(10001, '验证码错误', ['code' => '']);
- }
- }
- }
|