烂翻译系列之Iris——API示例之查询字符串参数
Querystring parameters 查询字符串参数
func main() { app := iris.Default() // Query string parameters are parsed using the existing underlying request object. // The request responds to a url matching: /welcome?firstname=Jane&lastname=Doe app.Get("/welcome", func(ctx iris.Context) { firstname := ctx.URLParamDefault("firstname", "Guest") lastname := ctx.URLParam("lastname") // shortcut for ctx.Request().URL.Query().Get("lastname") ctx.Writef("Hello %s %s", firstname, lastname) }) app.Listen(":8080") }
作者:菜鸟吊思
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.
施主您好,贫僧接受供养,施主一粒米,大如须弥山!南无阿弥陀佛!
您学习别人出学费,只需先扫红包码,后扫支付码!

浙公网安备 33010602011771号