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 66$ composer require zhenmu/support -vvv
77```
88
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-
199## 使用
2010
21- ### 控制器
22-
23111 . 通过 ` ./webman make:controller ` 控制器生成后,继承同目录下的 ` WebmanBaseController ` 基类。
24122 . 编写接口时可通过 ` $this->success($data = [], $err_code = 200, $messsage = 'success'); ` 返回正确数据给接口。
25133 . 编写接口时可通过 ` $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+ ### 控制器
2718
2819``` php
2920<?php
You can’t perform that action at this time.
0 commit comments