这里我们定义一个html的静态文件,模拟用户正常提交表单
业务代码实现:
from flask import Flask, request标签:__,test2,请求,age,request,post,name From: https://www.cnblogs.com/yongheng999/p/18309340
app=Flask(__name__)
@app.route('/test2',methods=['POST'])
def test2():
name = request.form.get('user_name')
age = request.form.get('user_age')
print("用户姓名为:{}类型是:{}".format(name,type(name)))
print("用户年龄为:{}类型是:{}".format(age,type(age)))
return "OK!"
if __name__ == '__main__':
app.run()