讨论数量:
Iris的session实现,有存储类似错误消息这类用过即丢的一次性Flash
方法如下。然后你需要考虑的就是在中间件或请求中,将错误信息放到flash session内即可,也可通过ctx.Value() 对象存储。或者考虑在iris的mvc应用BeforeActivation方法内作手脚。
SetFlash(key string, value interface{})
HasFlash() bool
GetFlashes() map[string]interface{}
PeekFlash(key string) interface{}
GetFlash(key string) interface{}
GetFlashString(key string) string
GetFlashStringDefault(key string, defaultValue string) string
DeleteFlash(key string)
ClearFlashes()
Iris的session实现,有存储类似错误消息这类用过即丢的一次性
Flash
方法如下。然后你需要考虑的就是在中间件或请求中,将错误信息放到flash session内即可,也可通过ctx.Value() 对象存储。或者考虑在iris的mvc应用BeforeActivation方法内作手脚。