① . 访问当前位置的上下文
② $. 访问模板根级上下文
③ $var 访问创建的变量
1.先在controller文件夹中创建xxxx.go
2.在xxxx.go中创建结构体type xxxxcontroller struct{ beego.controller }
3.在routers文件夹router.go中注册路由 ,变量名是xxxx.go func的变量名
beego.Router("/xxxx",&controllers.xxxxController{},"Get:变量名")
4.在xxxx.go中
func(this *xxxxController) 变量名(){
this.Data[" "]
this.Tplname="yyyy.tpl"
5.在views文件夹中创建file为后缀的yyyy.tpl模块文件
6.在yyyy.tpl中,结尾要写end
{ {range}} //range是循环
{ {end}}
7.访问:localhost:8080/xxxx