controller 設計
controller 作用
beego 的 REST 設計
type Controller struct {
Ct *Context
Tpl *template.Template
Data map[interface{}]interface{}
ChildName string
TplNames string
Layout []string
TplExt string
}
type ControllerInterface interface {
Init(ct *Context, cn string) //初始化上下文和子類別名稱稱
Prepare() //開始執行之前的一些處理
Get() //method=GET 的處理
Post() //method=POST 的處理
Delete() //method=DELETE 的處理
Put() //method=PUT 的處理
Head() //method=HEAD 的處理
Patch() //method=PATCH 的處理
Options() //method=OPTIONS 的處理
Finish() //執行完成之後的處理
Render() error //執行完 method 對應的方法之後渲染頁面
}應用指南

links
Last updated