1 Star 1 Fork 0

teamlint/iris

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.go 884 Bytes
一键复制 编辑 原始数据 按行查看 历史
venjiang 提交于 2018-08-14 10:08 . update to iris version 10.7.0
package routes
import (
"github.com/teamlint/iris/sessions"
"github.com/teamlint/iris"
)
// Index will increment a simple int version based on the visits that this user/session did.
func Index(ctx iris.Context, session *sessions.Session) {
// it increments a "visits" value of integer by one,
// if the entry with key 'visits' doesn't exist it will create it for you.
visits := session.Increment("visits", 1)
// write the current, updated visits.
ctx.Writef("%d visit(s) from my current session", visits)
}
/*
You can also do anything that an MVC function can, i.e:
func Index(ctx iris.Context,session *sessions.Session) string {
visits := session.Increment("visits", 1)
return fmt.Spritnf("%d visit(s) from my current session", visits)
}
// you can also omit iris.Context input parameter and use dependency injection for LoginForm and etc. <- look the mvc examples.
*/
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/teamlint/iris.git
git@gitee.com:teamlint/iris.git
teamlint
iris
iris
v10.7.0

搜索帮助