## POST请求类型
可以通过`@SWG\Post()` 设置post请求类型的注释
```
/* @SWG\Post(
* path="/index/register/index",
* tags={"用户相关"},
* summary="用户注册",
* security={{"apikey"={}}},
* consumes={"application/json"},
* produces={"application/json"},
* description="用户请求逻辑,记住用户请求一定要带token",
* /),
```
参数说明:
| 参数 |含义 |
| --- | --- |
| path | 请求路径 |
| tags | 用于API文档控制的标记列表。标记可用于按资源或任何其他限定符对操作进行逻辑分组 |
| summary | 接口名称 |
| name | 名称 |
| consumes | 设置parameter请求类型 |
| produces | 设置 response 返回类型 |
| description |对接口的详细解释 |
| security |接口的安全设置 |
apiKey示例:
```
/* *
*@SWG\SecurityScheme(securityDefinition="apikey",type="apiKey",name="apikey",in="query"),
* @SWG\Post(
* path="/index/register/index",
* tags={"用户相关"},
* summary="用户注册",
* security={{"apikey"={}}},
* )
*/
```
OAuth2示例:
```
/* *
*@SWG\SecurityScheme(securityDefinition="auth",type="oauth2",name="auth",scopes={"write:pets"="modify pets in your account","read:pets"="read your pets"},flow="implicit",authorizationUrl="http://swagger.io/api/oauth/dialog")
* @SWG\Post(
* path="/index/register/index",
* tags={"用户相关"},
* summary="用户注册",
* security={{auth"={"write:pets","read:pets"}}},
* )
*/
```
> *注意:参数`security `定义将覆盖任何已声明的顶级安全性
> 设置多个相同的`tags`值,swagger会自动进行逻辑分组
```
/* @SWG\Post(
* path="/index/index/regiser",
* tags={"用户相关"},
* summary="用户注册",
* consumes={"application/json"},
* produces={"application/json"},
* @SWG\Response(response="200",description="ok")
* )
*
* @SWG\Post(
* path="/index/index/user",
* tags={"用户相关"},
* summary="用户登录",
* consumes={"application/json"},
* produces={"application/json"},
* @SWG\Response(response="200",description="ok")
* )
* /
```
> `@SWG\Get()`,`@SWG\Post()`,`@SWG\Delete()`,`@SWG\Put()`,4种请求方式里面的参数都相同所以只写了POST的请求示例