草庐IT

go - Web.go 如何进行 http 重定向?

我正在使用web.go编写一个小型应用程序,该应用程序具有提供表单的功能。如果表单无效,用户将被重定向到同一页面:funcmypage(ctx*web.Context){ifctx.Request.Method=="GET"{//showtheform}elseifctx.Request.Method=="POST"{//redirectioniftheformisnotvalid:ctx.Request.Method="GET"http.Redirect(ctx.ResponseWriter,ctx.Request,"/mypage",http.StatusNotAcceptable

go - Web.go 如何进行 http 重定向?

我正在使用web.go编写一个小型应用程序,该应用程序具有提供表单的功能。如果表单无效,用户将被重定向到同一页面:funcmypage(ctx*web.Context){ifctx.Request.Method=="GET"{//showtheform}elseifctx.Request.Method=="POST"{//redirectioniftheformisnotvalid:ctx.Request.Method="GET"http.Redirect(ctx.ResponseWriter,ctx.Request,"/mypage",http.StatusNotAcceptable
12