
讯享网
bar.html
bar: {
{
.|lower }}
讯享网
index.html

讯享网{
{
.name }} {
{
if .body }} 男 {
{
else }} 女 {
{
end }} {
{
range .scores }} {
{
.}}| {
{
end }} <br/> {
{
range $index,$value := .scores }} {
{
$index}} = {
{
$value}} <br /> {
{
end }} {
{
range .users }} {
{
. }} {
{
end }} {
{
range $key, $value := .users }} {
{
$key }} = {
{
$value }} <br/> {
{
end }} {
{
lower .content }} {
{
.content|lower }} {
{
define "lower" }} 输入内容: {
{
.|lower }} {
{
end }} {
{
template "lower" .content }} {
{
template "lower" .content }} {
{
template "lower" .content }} {
{
template "lower" .content }} {
{
template "lower" .content }} {
{
template "lower" .content }} <br /> {
{
template "bar.html" .content}} {
{
template "bar.html" .content}} {
{
template "bar.html" .content}} {
{
template "bar.html" .content}} {
{
template "bar.html" .content}}
main.go
package main import ( "strings" "github.com/astaxie/beego" ) type HomeController struct {
beego.Controller } func (c *HomeController) Index() {
c.Data["name"] = "kk" c.Data["body"] = true c.Data["scores"] = []float32{
1, 2, 3, 4} c.Data["users"] = map[int]string{
1: "kk", 2: "wc"} c.Data["content"] = "abc.ABC" c.TplName = "index.html" // 默认后缀只支持html, tpl } func (c *HomeController) Home() {
// 若无任何响应,则加载控制器名称/Action名.tpl文件显示 } func main() {
beego.AddFuncMap("lower", func(in string) string {
return strings.ToLower(in) }) beego.AutoRouter(&HomeController{
}) beego.Run() }
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/65809.html