Add more term fixes and markdown format fixes

This commit is contained in:
Will
2019-03-03 00:40:37 +08:00
parent accc3cc768
commit d5355ad2ec
69 changed files with 573 additions and 393 deletions

View File

@@ -36,6 +36,7 @@ type ControllerInterface interface {
}
```
那麼前面介紹的路由 add 函式的時候是定義了 ControllerInterface 型別,因此,只要我們實現這個介面就可以,所以我們的基底類別 Controller 實現如下的方法:
```Go
func (c *Controller) Init(ct *Context, cn string) {
@@ -118,6 +119,7 @@ func (c *Controller) Redirect(url string, code int) {
}
```
上面的 controller 基底類別已經實現了介面定義的函式,透過路由根據 url 執行相應的 controller 的原則,會依次執行如下:
```Go
Init() 初始化
@@ -129,6 +131,7 @@ Finish() 執行完之後執行的操作,每個繼承的子類別可以來
```
## 應用指南
上面 beego 框架中完成了 controller 基底類別的設計,那麼我們在我們的應用中可以這樣來設計我們的方法:
```Go
package controllers