Skip to content

Commit ba7551a

Browse files
author
jay
committed
add sms
1 parent b2c414e commit ba7551a

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

Business/CaptchaBusiness/CaptchaBusiness.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public function captcha($captcha, $format = null)
4040
header('Cache-Control: no-cache');
4141

4242
$builder->output();
43+
44+
return new Response();
4345
}
4446

4547
/**

Controller/CaptchaController.php renamed to Controller/Captcha/CaptchaController.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,22 @@
55
* Date: 2021/3/9
66
*/
77

8-
namespace App\Controller;
8+
namespace App\Controller\Captcha;
99

1010
use App\Business\CaptchaBusiness\CaptchaBusiness;
11+
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1112
use Symfony\Component\HttpFoundation\Request;
1213
use Symfony\Component\HttpFoundation\Response;
1314

14-
class CaptchaController
15+
class CaptchaController extends AbstractController
1516
{
1617
/**
1718
* 图形验证码
1819
*
1920
* @param Request $request
2021
* @return Response
2122
*/
22-
public function captcha(Request $request)
23+
public function generate(Request $request)
2324
{
2425
return (new CaptchaBusiness($this->container))->captcha($request->get('captcha', 'captcha'), $request->get('format'));
2526
}

Document/CaptchaDocument.php renamed to Document/Captcha/CaptchaDocument.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<?php
2-
3-
namespace App\Document;
4-
5-
use PHPZlc\Document\Document;
6-
72
/**
83
* PhpStorm.
94
* User: Jay
10-
* Date: 2021/3/9
5+
* Date: 2021/3/10
116
*/
127

8+
namespace App\Document\Captcha;
9+
10+
11+
use PHPZlc\Document\Document;
12+
1313
class CaptchaDocument extends Document
1414
{
1515
public function add()

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
# 图形验证码库
22

33
# 安装
4-
composer require phpzlc/captcha-business
4+
composer require phpzlc/captcha-business
5+
6+
# 引用
7+
8+
`config/routes.yaml`
9+
10+
```yaml
11+
captcha:
12+
resource: "routing/captcha/captcha.yaml"
13+
prefix: /captcha
14+
```

routing/captcha.yaml

Whitespace-only changes.

routing/captcha/captcha.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 验证码生成
2+
captcha_generate:
3+
path: /generate
4+
controller: App\Controller\Captcha\CaptchaController:generate

0 commit comments

Comments
 (0)