📜  flask post 与 get - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:40.498000             🧑  作者: Mango

代码示例1
@app.route("/login", methods=["POST", "GET"])
def login():
    if request.method == "POST":
        user = request.form["name"]
        return redirect(url_for("success", name=user))
    else:
        user = request.args.get("name")
        return redirect(url_for("success", name=user))