## 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的請求示例