File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change 6
6
$ composer require zhenmu/support -vvv
7
7
```
8
8
9
- ## 基类创建控制器
10
-
11
- ``` php
12
- ./webman plugin:install zhen-mu/support
13
-
14
- or
15
-
16
- php ./vendor/zhenmu/support/src/scripts/install.php
17
- ```
18
-
19
9
## 使用
20
10
21
- ### 控制器
22
-
23
11
1 . 通过 ` ./webman make:controller ` 控制器生成后,继承同目录下的 ` WebmanBaseController ` 基类。
24
12
2 . 编写接口时可通过 ` $this->success($data = [], $err_code = 200, $messsage = 'success'); ` 返回正确数据给接口。
25
13
3 . 编写接口时可通过 ` $this->fail($messsage = '', $err_code = 400); ` 返回错误信息给接口。
26
- 4 . 在 ` support/exception/Handler.php ` 的 ` render ` 函数中,调用 ` WebmanResponseTrait ` 的 ` $this->renderableHandle($request, $exception); ` 示例如下:
14
+ 4 . 在 ` support/exception/Handler.php ` 的 ` render ` 函数中,调用 ` WebmanResponseTrait ` 的 ` $this->renderableHandle($request, $exception); ` 示例见下方错误处理。
15
+
16
+
17
+ ### 控制器
27
18
28
19
``` php
29
20
<?php
You can’t perform that action at this time.
0 commit comments