beego记录2(边写边记)

1.string、int、int64互相转换

#string到int
int,err:=strconv.Atoi(string)
#string到int64
int64, err := strconv.ParseInt(string, 10, 64)
#int到string
string:=strconv.Itoa(int)
#int64到string
string:=strconv.FormatInt(int64,10)

2.range中使用其他的变量

{{$ntype1 := .ntype1}}{{range $index,$page := .paginator.pages}}
  <li ><a href="/teacher/newlist/{{ $ntype1}}?page={{$page}}" {{if eq $.paginator.currpage $page }} style="background-color: #005197;color: #fff;"{{end}}>{{$page}}</a></li>
 {{end}}

猜你喜欢

转载自blog.csdn.net/a976134036/article/details/79006215