我试图在我的Handler函数上进行一些处理之后传递一些变量。我怎样才能redirect到一个新页面并将一些 json 变量传递给这个新模板?
// main package
func main() {
apiRoutes := gin.Default()
apiRoutes.POST("api/ipg/send", controllers.GatewayIpgSendHandler)
apiRoutes.GET("ipg/:token", controllers.GatewayIpgRequestHandler)
// ... rest of the codes
}
// controllers package
func GatewayIpgRequestHandler(context *gin.Context) {
// some processes that lead to these variables.
wage := 123
amount := 13123
redirectUrl := "www.test.com/callback"
// What should I do here to pass those
// three variables above to an existing `custom-view.tmpl` file
// in my `templates` folder.
}
这是我想做的 php(laravel) 等价物。
扬帆大鱼
qq_笑_17
随时随地看视频慕课网APP
相关分类